Skip to content

Commit

Permalink
Migrated autonicer.file_find -> glob.glob for tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nkphysics committed Dec 15, 2022
1 parent 3a5056f commit 66eaef0
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions tests/test_autonicer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import shutil
import subprocess as sp
import tarfile
import glob

base_dir = os.getcwd()
os.mkdir("data")
Expand Down Expand Up @@ -125,13 +126,13 @@ def test_pullreduce():
an.command_center("3013010102")
an.command_center("done")
os.chdir(f"{base_dir}/data/3013010102/xti/event_cl/")
ufa = autonicer.file_find("*ufa.evt")
ufa = glob.glob("*ufa.evt")
assert len(ufa) == 0
ufa_gz = autonicer.file_find("*ufa.evt.gz")
ufa_gz = glob.glob("*ufa.evt.gz")
assert len(ufa_gz) == 8
cl = autonicer.file_find("*cl.evt")
cl = glob.glob("*cl.evt")
assert len(cl) == 2
cl_gz = autonicer.file_find("*cl.evt.gz")
cl_gz = glob.glob("*cl.evt.gz")
assert len(cl_gz) == 0
os.chdir(f"{base_dir}")

Expand Down Expand Up @@ -169,8 +170,8 @@ def test_decompress(setup_reprocess):
check = setup_reprocess
comp_det = check.decompress()
assert comp_det is True
gzs = autonicer.file_find("*evt.gz")
tars = autonicer.file_find("*.tar.gz")
gzs = glob.glob("*evt.gz")
tars = glob.glob("*.tar.gz")
assert len(gzs) == 0
assert len(tars) == 0
os.chdir(f"{base_dir}/data/")
Expand Down Expand Up @@ -206,7 +207,9 @@ def test_reprocess(setup_reprocess):
def test_checkcal_reprocess(capsys):
try:
os.chdir(f"{base_dir}/data")
autonicer.run(["--checkcal", "--reprocess", "--bc", "--compress", "--inlist=test.csv"])
autonicer.run(
["--checkcal", "--reprocess", "--bc", "--compress", "--inlist=test.csv"]
)
except SystemExit:
pass
out, err = capsys.readouterr()
Expand Down

0 comments on commit 66eaef0

Please sign in to comment.