Skip to content

Commit

Permalink
100% coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ponyisi committed Feb 7, 2022
1 parent 0bea2ec commit 47ea97e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
Empty file removed tests/test_empty.yaml
Empty file.
11 changes: 11 additions & 0 deletions tests/test_pieces.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def test_rootio():
rom.configure({'target': ''})
rom.finalize()

# this is also for coverage completeness (see that we get everything if no selector is set for the input module)
import subprocess
chk = subprocess.run("python -m histgrinder.make_sample_file",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(chk.stdout)
chk.check_returncode()

rim.configure({'source': 'example.root'})
inputs = list(rim.iterate(dryrun=True))
assert len(inputs) == 101


def test_badconfig():
from histgrinder.config import read_configuration
Expand Down
24 changes: 8 additions & 16 deletions tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,13 @@ def test_run_newfile():
pytest.importorskip("ROOT")

import subprocess
import os.path
chk = subprocess.run("python -m histgrinder.make_sample_file",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(chk.stdout)
chk.check_returncode()
if os.path.exists('new.root'):
os.remove('new.root')
chk = subprocess.run("python -m histgrinder.engine example.root new.root -c tests/test_functional.yaml --prefix prefix",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(chk.stdout)
Expand Down Expand Up @@ -73,17 +76,20 @@ def test_run_absprefix():
pytest.importorskip("ROOT")

import subprocess
import os.path
chk = subprocess.run("python -m histgrinder.make_sample_file",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(chk.stdout)
chk.check_returncode()
chk = subprocess.run("python -m histgrinder.engine example.root example.root "
if os.path.exists('new.root'):
os.remove('new.root')
chk = subprocess.run("python -m histgrinder.engine example.root new.root "
"-c tests/test_functional.yaml --prefix /prefix",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(chk.stdout)
chk.check_returncode()

return content_verify()
return content_verify(newfile=True)


def test_run_defer():
Expand Down Expand Up @@ -179,20 +185,6 @@ def test_run_bad_prefix():
chk.check_returncode()


def test_run_nocode():
pytest.importorskip("ROOT")

import subprocess
chk = subprocess.run("python -m histgrinder.make_sample_file",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(chk.stdout)
chk.check_returncode()
chk = subprocess.run("python -m histgrinder.engine example.root example.root -c tests/test_empty.yaml --prefix /prefix",
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
print(chk.stdout)
chk.check_returncode()


def test_run_badtype():
pytest.importorskip("ROOT")

Expand Down

0 comments on commit 47ea97e

Please sign in to comment.