-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add more coverage for testing the entry point script. see #198.
- Loading branch information
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
import json | ||
import shlex | ||
|
||
import pyhf | ||
|
||
# see test_import.py for the same (detailed) test | ||
def test_import_prepHistFactory(tmpdir, script_runner): | ||
temp = tmpdir.join("parsed_output.json") | ||
command = 'pyhf_xml2json --entrypoint-xml validation/xmlimport_input/config/example.xml --workspace validation/xmlimport_input/ --output-file {0:s} --no-tqdm'.format(temp.strpath) | ||
ret = script_runner.run(*shlex.split(command)) | ||
assert ret.success | ||
assert ret.stdout == '' | ||
assert ret.stderr == '' | ||
|
||
parsed_xml = json.loads(temp.read()) | ||
spec = {'channels': parsed_xml['channels']} | ||
pyhf.utils.validate(spec, pyhf.utils.get_default_schema()) | ||
|
||
def test_import_prepHistFactory_TQDM(tmpdir, script_runner): | ||
temp = tmpdir.join("parsed_output.json") | ||
command = 'pyhf_xml2json --entrypoint-xml validation/xmlimport_input/config/example.xml --workspace validation/xmlimport_input/ --output-file {0:s}'.format(temp.strpath) | ||
ret = script_runner.run(*shlex.split(command)) | ||
assert ret.success | ||
assert ret.stdout == '' | ||
assert ret.stderr != '' | ||
|