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

View File

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

View File

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

View File

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

View File

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

View File

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