Skip to content

Commit

Permalink
Speed-up test by running over 0 events
Browse files Browse the repository at this point in the history
For this test, we don't need to run over any events,as the output
structure is fixed beforehand
  • Loading branch information
gonzaponte committed May 15, 2024
1 parent ee56ff1 commit bd7de53
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion invisible_cities/cities/cities_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,28 @@ def test_city_output_file_is_compressed(config_tmpdir, ICDATADIR, city):
config_file = 'dummy invisible_cities/config/{}.conf'.format(city)

conf = configure(config_file.split())
conf.update(dict(file_out = file_out))
conf.update(dict( file_out = file_out
, event_range = 0))

module_name = f'invisible_cities.cities.{city}'
city_function = getattr(import_module(module_name), city)

city_function(**conf)

checked_nodes = 0
with tb.open_file(file_out) as file:
for node in chain([file], file.walk_nodes()):
try:
assert (node.filters.complib is not None and
node.filters.complevel > 0)
checked_nodes += 1

except tb.NoSuchNodeError:
continue

# ensure that we didn't pass the test because there were no nodes checked
assert checked_nodes > 2


@mark.filterwarnings("ignore::UserWarning")
@mark.parametrize("city", all_cities)
Expand Down

0 comments on commit bd7de53

Please sign in to comment.