From b257a3411a9dec1a22e53b46eef0827a3c202a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20P=C3=B6hn?= Date: Wed, 29 Jan 2020 13:08:43 +0100 Subject: [PATCH] stick to default python sys.path --- fdroidserver/__main__.py | 1 - tests/main.TestCase | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/fdroidserver/__main__.py b/fdroidserver/__main__.py index fa7eb02a..46cf87df 100755 --- a/fdroidserver/__main__.py +++ b/fdroidserver/__main__.py @@ -91,7 +91,6 @@ def find_plugins(): def main(): - sys.path.append(os.getcwd()) fdroid_modules = find_plugins() if len(sys.argv) <= 1: diff --git a/tests/main.TestCase b/tests/main.TestCase index c303f181..e33c6758 100755 --- a/tests/main.TestCase +++ b/tests/main.TestCase @@ -84,10 +84,13 @@ class MainTest(unittest.TestCase): f.write(textwrap.dedent("""\ fdroid_summary = "ttt" main = lambda: pritn('all good')""")) - with mock.patch('sys.argv', ['', 'testy']): - with mock.patch('sys.exit') as exit_mock: - fdroidserver.__main__.main() - exit_mock.assert_called_once_with(0) + test_path = sys.path.copy() + test_path.append(tmpdir) + with mock.patch('sys.path', test_path): + with mock.patch('sys.argv', ['', 'testy']): + with mock.patch('sys.exit') as exit_mock: + fdroidserver.__main__.main() + exit_mock.assert_called_once_with(0) if __name__ == "__main__":