diff --git a/tests/helpers/utils.py b/tests/helpers/utils.py index 003947e3c..d3ef3cd70 100644 --- a/tests/helpers/utils.py +++ b/tests/helpers/utils.py @@ -104,13 +104,11 @@ def pattern_match(*, pattern, value): return re.fullmatch(re_pattern, value) is not None -def abs_datapath(from_file): - """Get the absolute datapath. - - __FILE__ must be given as an argument +def abs_datapath(): + """Get the absolute path to the integration data directory. Return: The absolute path to the tests/integration/data directory. """ - file_abs = os.path.abspath(os.path.dirname(from_file)) - return os.path.join(file_abs, '..', 'data') + file_abs = os.path.abspath(os.path.dirname(__file__)) + return os.path.join(file_abs, '..', 'integration', 'data') diff --git a/tests/integration/features/conftest.py b/tests/integration/features/conftest.py index 67c5b2ce5..a099a1887 100644 --- a/tests/integration/features/conftest.py +++ b/tests/integration/features/conftest.py @@ -140,10 +140,10 @@ def run_userscript(quteproc, userscript): Wrapper around :spawn --userscript {userscript} that uses an absolute path. """ - abs_userscript_path = os.path.join(utils.abs_datapath(__file__), + abs_userscript_path = os.path.join(utils.abs_datapath(), 'userscripts', userscript) - cmd = ':spawn --userscript "{abs_userscript_path}"' + cmd = ':spawn --userscript {abs_userscript_path}' quteproc.send_cmd(cmd.format(abs_userscript_path=abs_userscript_path)) @@ -349,7 +349,7 @@ def check_contents(quteproc, filename): The filename is interpreted relative to tests/integration/data. """ content = quteproc.get_content(plain=False) - path = os.path.join(utils.abs_datapath(__file__), + path = os.path.join(utils.abs_datapath(), os.path.join(*filename.split('/'))) with open(path, 'r', encoding='utf-8') as f: file_content = f.read()