import: always load testcommon from localmodule

Having this import before sys.path.insert() made it load testcommon from
the Debian package.
This commit is contained in:
Hans-Christoph Steiner 2024-05-06 11:13:13 +02:00
parent 1e5699e90c
commit 685efa23d4
6 changed files with 6 additions and 8 deletions

View file

@ -14,7 +14,6 @@ from unittest import mock
from pathlib import Path from pathlib import Path
import requests import requests
from testcommon import TmpCwd, mkdtemp
localmodule = Path(__file__).resolve().parent.parent localmodule = Path(__file__).resolve().parent.parent
print('localmodule: ' + str(localmodule)) print('localmodule: ' + str(localmodule))
@ -25,6 +24,7 @@ import fdroidserver.common
import fdroidserver.import_subcommand import fdroidserver.import_subcommand
import fdroidserver.metadata import fdroidserver.metadata
from fdroidserver.exception import FDroidException from fdroidserver.exception import FDroidException
from testcommon import TmpCwd, mkdtemp
class ImportTest(unittest.TestCase): class ImportTest(unittest.TestCase):

View file

@ -10,7 +10,6 @@ import sys
import tempfile import tempfile
import unittest import unittest
from pathlib import Path from pathlib import Path
from testcommon import mkdtemp
localmodule = Path(__file__).resolve().parent.parent localmodule = Path(__file__).resolve().parent.parent
print('localmodule: ' + str(localmodule)) print('localmodule: ' + str(localmodule))
@ -21,6 +20,7 @@ import fdroidserver.common
import fdroidserver.lint import fdroidserver.lint
import fdroidserver.metadata import fdroidserver.metadata
from fdroidserver.common import CATEGORIES_CONFIG_NAME from fdroidserver.common import CATEGORIES_CONFIG_NAME
from testcommon import mkdtemp
class LintTest(unittest.TestCase): class LintTest(unittest.TestCase):

View file

@ -8,7 +8,6 @@ import textwrap
import unittest import unittest
import tempfile import tempfile
from unittest import mock from unittest import mock
from testcommon import TmpCwd, TmpPyPath
localmodule = os.path.realpath( localmodule = os.path.realpath(
os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..') os.path.join(os.path.dirname(inspect.getfile(inspect.currentframe())), '..')
@ -19,6 +18,7 @@ if localmodule not in sys.path:
from fdroidserver import common from fdroidserver import common
import fdroidserver.__main__ import fdroidserver.__main__
from testcommon import TmpCwd, TmpPyPath
class MainTest(unittest.TestCase): class MainTest(unittest.TestCase):

View file

@ -15,8 +15,6 @@ from collections import OrderedDict
from pathlib import Path from pathlib import Path
from unittest import mock from unittest import mock
from testcommon import TmpCwd, mkdtemp
localmodule = Path(__file__).resolve().parent.parent localmodule = Path(__file__).resolve().parent.parent
print('localmodule: ' + str(localmodule)) print('localmodule: ' + str(localmodule))
if localmodule not in sys.path: if localmodule not in sys.path:
@ -26,6 +24,7 @@ import fdroidserver
from fdroidserver import metadata from fdroidserver import metadata
from fdroidserver.exception import MetaDataException from fdroidserver.exception import MetaDataException
from fdroidserver.common import DEFAULT_LOCALE from fdroidserver.common import DEFAULT_LOCALE
from testcommon import TmpCwd, mkdtemp
def _get_mock_mf(s): def _get_mock_mf(s):

View file

@ -8,14 +8,13 @@ import tempfile
import textwrap import textwrap
from pathlib import Path from pathlib import Path
from testcommon import TmpCwd, mkdtemp
localmodule = Path(__file__).resolve().parent.parent localmodule = Path(__file__).resolve().parent.parent
print('localmodule: ' + str(localmodule)) print('localmodule: ' + str(localmodule))
if localmodule not in sys.path: if localmodule not in sys.path:
sys.path.insert(0, str(localmodule)) sys.path.insert(0, str(localmodule))
from fdroidserver import common, metadata, rewritemeta from fdroidserver import common, metadata, rewritemeta
from testcommon import TmpCwd, mkdtemp
class RewriteMetaTest(unittest.TestCase): class RewriteMetaTest(unittest.TestCase):

View file

@ -23,7 +23,6 @@ import textwrap
from binascii import hexlify from binascii import hexlify
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
from testcommon import TmpCwd, mkdtemp
from unittest import mock from unittest import mock
try: try:
@ -61,6 +60,7 @@ import fdroidserver.metadata
import fdroidserver.update import fdroidserver.update
from fdroidserver.common import CATEGORIES_CONFIG_NAME from fdroidserver.common import CATEGORIES_CONFIG_NAME
from fdroidserver.looseversion import LooseVersion from fdroidserver.looseversion import LooseVersion
from testcommon import TmpCwd, mkdtemp
DONATION_FIELDS = ('Donate', 'Liberapay', 'OpenCollective') DONATION_FIELDS = ('Donate', 'Liberapay', 'OpenCollective')