Commit 8372016755363489422d66e669e92f4a6319f61d

Authored by Christian Herdtweck
1 parent da5d4644

tests: Use common base dirs in log_helper tests

tests/common/log_helper/test_log_helper.py
@@ -13,9 +13,11 @@ from tests.common.log_helper import log_helper_test_main @@ -13,9 +13,11 @@ from tests.common.log_helper import log_helper_test_main
13 from tests.common.log_helper import log_helper_test_imported 13 from tests.common.log_helper import log_helper_test_imported
14 from os.path import dirname, join, relpath, abspath 14 from os.path import dirname, join, relpath, abspath
15 15
  16 +from tests.test_utils import PROJECT_ROOT
  17 +
16 # this is the common base of "tests" and "oletools" dirs 18 # this is the common base of "tests" and "oletools" dirs
17 -ROOT_DIRECTORY = abspath(join(__file__, '..', '..', '..', '..'))  
18 -TEST_FILE = relpath(join(dirname(__file__), 'log_helper_test_main.py'), ROOT_DIRECTORY) 19 +TEST_FILE = relpath(join(dirname(abspath(__file__)), 'log_helper_test_main.py'),
  20 + PROJECT_ROOT)
19 PYTHON_EXECUTABLE = sys.executable 21 PYTHON_EXECUTABLE = sys.executable
20 22
21 MAIN_LOG_MESSAGES = [ 23 MAIN_LOG_MESSAGES = [
@@ -90,9 +92,9 @@ class TestLogHelper(unittest.TestCase): @@ -90,9 +92,9 @@ class TestLogHelper(unittest.TestCase):
90 child = subprocess.Popen( 92 child = subprocess.Popen(
91 [PYTHON_EXECUTABLE, TEST_FILE] + args, 93 [PYTHON_EXECUTABLE, TEST_FILE] + args,
92 shell=False, 94 shell=False,
93 - env={'PYTHONPATH': ROOT_DIRECTORY}, 95 + env={'PYTHONPATH': PROJECT_ROOT},
94 universal_newlines=True, 96 universal_newlines=True,
95 - cwd=ROOT_DIRECTORY, 97 + cwd=PROJECT_ROOT,
96 stdin=None, 98 stdin=None,
97 stdout=subprocess.PIPE, 99 stdout=subprocess.PIPE,
98 stderr=subprocess.PIPE 100 stderr=subprocess.PIPE