diff --git a/Scripts/deduplicate.py b/Scripts/deduplicate.py index 4f1a5a1..8f27842 100755 --- a/Scripts/deduplicate.py +++ b/Scripts/deduplicate.py @@ -14,8 +14,6 @@ from collections.abc import Iterable # Add current directory to path to allow importing common if run from elsewhere -if str(Path(__file__).parent) not in sys.path: - sys.path.append(str(Path(__file__).parent)) from common import is_valid_domain, write_lines diff --git a/Scripts/move-pure-domains.py b/Scripts/move-pure-domains.py index bc6dd89..a7bc951 100644 --- a/Scripts/move-pure-domains.py +++ b/Scripts/move-pure-domains.py @@ -9,8 +9,6 @@ from collections import defaultdict # Import common utilities -if str(Path(__file__).parent) not in sys.path: - sys.path.append(str(Path(__file__).parent)) from common import is_valid_domain, read_lines, write_lines diff --git a/Scripts/test_common.py b/Scripts/test_common.py index 86e8ef1..50a7076 100644 --- a/Scripts/test_common.py +++ b/Scripts/test_common.py @@ -1,11 +1,8 @@ import unittest -import sys from pathlib import Path import hashlib # Add current directory to path -if str(Path(__file__).parent) not in sys.path: - sys.path.append(str(Path(__file__).parent)) from common import sanitize_filename, is_valid_domain, is_adguard_rule diff --git a/Scripts/test_deduplicate.py b/Scripts/test_deduplicate.py index 5e8c577..92eeaaa 100644 --- a/Scripts/test_deduplicate.py +++ b/Scripts/test_deduplicate.py @@ -1,10 +1,6 @@ import unittest -import sys -from pathlib import Path # Add current directory to path to allow importing deduplicate -if str(Path(__file__).parent) not in sys.path: - sys.path.append(str(Path(__file__).parent)) from deduplicate import process_content diff --git a/Scripts/test_is_pure_domain_logic.py b/Scripts/test_is_pure_domain_logic.py index 7dc4ad8..e9b679f 100644 --- a/Scripts/test_is_pure_domain_logic.py +++ b/Scripts/test_is_pure_domain_logic.py @@ -1,13 +1,6 @@ import unittest -import sys -from pathlib import Path import importlib -# Add Scripts to path -scripts_dir = Path(__file__).parent -if str(scripts_dir) not in sys.path: - sys.path.append(str(scripts_dir)) - # Import ADGUARD_INDICATORS from common from common import ADGUARD_INDICATORS diff --git a/Scripts/test_update_lists.py b/Scripts/test_update_lists.py index 2654d93..5b20097 100644 --- a/Scripts/test_update_lists.py +++ b/Scripts/test_update_lists.py @@ -20,7 +20,9 @@ class ClientError(Exception): sys.modules["aiohttp"] = aiohttp_mock sys.modules["aiofiles"] = MagicMock() -spec = importlib.util.spec_from_file_location("update_lists", "Scripts/update-lists.py") +spec = importlib.util.spec_from_file_location( + "update_lists", str(Path(__file__).parent / "update-lists.py") +) update_lists = importlib.util.module_from_spec(spec) sys.modules["update_lists"] = update_lists spec.loader.exec_module(update_lists) diff --git a/Scripts/update-lists.py b/Scripts/update-lists.py index 6bc4d15..fda7dba 100644 --- a/Scripts/update-lists.py +++ b/Scripts/update-lists.py @@ -21,8 +21,6 @@ import aiofiles # Import common utilities -if str(Path(__file__).parent) not in sys.path: - sys.path.append(str(Path(__file__).parent)) from common import sanitize_filename