From 86a4bd12b570bd044c595f8100877e0da974affd Mon Sep 17 00:00:00 2001 From: Kelly Brazil Date: Thu, 14 Mar 2024 17:29:31 -0700 Subject: [PATCH] fix for tests run inside vscode --- tests/templates/_test_foo_simple.py | 5 ++++- tests/test_apt_cache_show.py | 5 ++++- tests/test_apt_get_sqq.py | 5 ++++- tests/test_curl_head.py | 4 ++++ tests/test_ethtool.py | 5 ++++- tests/test_http_headers.py | 4 ++++ tests/test_needrestart.py | 5 ++++- tests/test_path.py | 6 ++++-- tests/test_path_list.py | 7 ++++++- 9 files changed, 38 insertions(+), 8 deletions(-) diff --git a/tests/templates/_test_foo_simple.py b/tests/templates/_test_foo_simple.py index 2bd24c5c..dfc4a27e 100644 --- a/tests/templates/_test_foo_simple.py +++ b/tests/templates/_test_foo_simple.py @@ -1,6 +1,9 @@ import unittest - +import os +import sys +sys.path.append(os.getcwd()) from tests import utils_for_test as test_utils +sys.path.pop() # Execute these steps for standard tests: # - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. diff --git a/tests/test_apt_cache_show.py b/tests/test_apt_cache_show.py index 234e61b3..77b48155 100644 --- a/tests/test_apt_cache_show.py +++ b/tests/test_apt_cache_show.py @@ -1,6 +1,9 @@ import unittest - +import os +import sys +sys.path.append(os.getcwd()) from tests import utils_for_test as test_utils +sys.path.pop() # Execute these steps for standard tests: # - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. diff --git a/tests/test_apt_get_sqq.py b/tests/test_apt_get_sqq.py index a0243179..1df3e9b8 100644 --- a/tests/test_apt_get_sqq.py +++ b/tests/test_apt_get_sqq.py @@ -1,6 +1,9 @@ import unittest - +import os +import sys +sys.path.append(os.getcwd()) from tests import utils_for_test as test_utils +sys.path.pop() # Execute these steps for standard tests: # - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. diff --git a/tests/test_curl_head.py b/tests/test_curl_head.py index a3cc80a4..9df5dec8 100644 --- a/tests/test_curl_head.py +++ b/tests/test_curl_head.py @@ -1,5 +1,9 @@ import unittest +import os +import sys +sys.path.append(os.getcwd()) from tests import utils_for_test as test_utils +sys.path.pop() # Execute these steps for standard tests: # - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. diff --git a/tests/test_ethtool.py b/tests/test_ethtool.py index ed5e2083..a958d6a8 100644 --- a/tests/test_ethtool.py +++ b/tests/test_ethtool.py @@ -1,6 +1,9 @@ import unittest - +import os +import sys +sys.path.append(os.getcwd()) from tests import utils_for_test as test_utils +sys.path.pop() # Execute these steps for standard tests: # - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. diff --git a/tests/test_http_headers.py b/tests/test_http_headers.py index 25a2b4fd..b215b1c4 100644 --- a/tests/test_http_headers.py +++ b/tests/test_http_headers.py @@ -1,5 +1,9 @@ import unittest +import os +import sys +sys.path.append(os.getcwd()) from tests import utils_for_test as test_utils +sys.path.pop() # Execute these steps for standard tests: # - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. diff --git a/tests/test_needrestart.py b/tests/test_needrestart.py index d0e92f63..4b4bea96 100644 --- a/tests/test_needrestart.py +++ b/tests/test_needrestart.py @@ -1,6 +1,9 @@ import unittest - +import os +import sys +sys.path.append(os.getcwd()) from tests import utils_for_test as test_utils +sys.path.pop() # Execute these steps for standard tests: # - Save this file as `test_{parser_name}.py` since the helper methods extract parser names from the filename. diff --git a/tests/test_path.py b/tests/test_path.py index b00d5066..385ff726 100644 --- a/tests/test_path.py +++ b/tests/test_path.py @@ -1,7 +1,9 @@ import unittest - +import os +import sys +sys.path.append(os.getcwd()) from tests import utils_for_test as test_utils - +sys.path.pop() class MyTests(unittest.TestCase): diff --git a/tests/test_path_list.py b/tests/test_path_list.py index 9d920759..530ed422 100644 --- a/tests/test_path_list.py +++ b/tests/test_path_list.py @@ -1,7 +1,12 @@ import unittest - +import os +import sys +sys.path.append(os.getcwd()) from tests import utils_for_test as test_utils +sys.path.pop() +print(sys.path) +# TODO: Cleanup sys.path so it doesn't keep appending class MyTests(unittest.TestCase):