Skip to content

Commit

Permalink
Use patch.open() instead of .read_text()
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfeickert committed Nov 20, 2023
1 parent 4d34dbd commit 6347dbd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tests/test_scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def test_import_prepHistFactory_and_fit(tmp_path, script_runner):
command += f" --output-file {tmp_out}"
ret = script_runner.run(shlex.split(command))
assert ret.success
ret_json = json.load(tmp_out)
ret_json = json.load(tmp_out.open())
assert "mle_parameters" in ret_json
assert "twice_nll" in ret_json

Expand Down Expand Up @@ -159,7 +159,7 @@ def test_import_prepHistFactory_and_cls(tmp_path, script_runner):
command += f' --output-file {tmp_out}'
ret = script_runner.run(shlex.split(command))
assert ret.success
d = json.load(tmp_out)
d = json.load(tmp_out.open())
assert 'CLs_obs' in d
assert 'CLs_exp' in d

Expand Down Expand Up @@ -262,14 +262,14 @@ def test_patch(tmp_path, script_runner):

command = f'pyhf cls {temp} --patch -'

ret = script_runner.run(shlex.split(command), stdin=patch.read_text())
ret = script_runner.run(shlex.split(command), stdin=patch.open())
assert ret.success

output_dir_path = tmp_path / "output_2"
output_dir_path.mkdir(exist_ok=True)

command = f"pyhf json2xml {temp} --output-dir {output_dir_path} --patch -"
ret = script_runner.run(shlex.split(command), stdin=patch.read_text())
ret = script_runner.run(shlex.split(command), stdin=patch.open())
assert ret.success


Expand Down

0 comments on commit 6347dbd

Please sign in to comment.