Skip to content

Commit

Permalink
Fix test to check that output file does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
paolafer committed Jun 4, 2024
1 parent 670c8b6 commit 35e57d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 3 additions & 6 deletions invisible_cities/cities/buffy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,10 @@ def test_buffy_no_file_without_sns_response(config_tmpdir, ICDATADIR):
conf = configure('buffy invisible_cities/config/buffy.conf'.split())
conf.update(dict(files_in=file_in, file_out=file_out, event_range=nevt))

try:
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=UserWarning)
buffy(**conf)
except:
if not os.path.exists(file_out):
assert True
else:
assert False
assert not os.path.exists(file_out)


def test_buffy_filters_empty(config_tmpdir, ICDATADIR):
Expand Down
2 changes: 2 additions & 0 deletions invisible_cities/cities/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ def index_tables(file_out):
-checks if any columns in the tables have been marked to be indexed by writers
-indexes those columns
"""
if not os.path.exists(file_out):
return
with tb.open_file(file_out, 'r+') as h5out:
for table in h5out.walk_nodes(classname='Table'): # Walk over all tables in h5out
if 'columns_to_index' not in table.attrs: continue # Check for columns to index
Expand Down

0 comments on commit 35e57d4

Please sign in to comment.