Remove unneeded argument

Instead, figure out the data directory from the helpers directory.
This commit is contained in:
Philipp Hansch 2016-03-29 19:52:46 +02:00
parent 4a1ba45efa
commit e0e8bc805b
2 changed files with 7 additions and 9 deletions

View File

@ -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')

View File

@ -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()