10
10
11
11
from .. core .configure import configure
12
12
13
- online_cities = "irene dorothea sophronia esmeralda beersheba" .split ()
14
- all_cities = """beersheba berenice buffy detsim diomira dorothea esmeralda
15
- eutropia hypathia irene isaura isidora phyllis sophronia
16
- trude""" .split ()
13
+ online_cities = "irene dorothea sophronia esmeralda beersheba isaura" .split ()
14
+ mc_cities = "buffy detsim diomira hypathia" .split ()
15
+ other_cities = "berenice isidora phyllis trude eutropia" .split ()
16
+ all_cities = sorted (online_cities + mc_cities + other_cities )
17
+ all_cities_with_event_range = sorted (set (all_cities ).difference (set (["eutropia" ])))
18
+
17
19
18
20
@mark .filterwarnings ("ignore::UserWarning" )
19
21
@mark .parametrize ("city" , online_cities )
@@ -35,6 +37,23 @@ def test_city_empty_input_file(config_tmpdir, ICDATADIR, city):
35
37
city_function (** conf )
36
38
37
39
40
+ @mark .filterwarnings ("ignore::UserWarning" )
41
+ @mark .parametrize ("city" , all_cities_with_event_range )
42
+ def test_city_null_event_range (config_tmpdir , ICDATADIR , city ):
43
+ # All cities must run with event_range = 0
44
+ PATH_OUT = os .path .join (config_tmpdir , 'empty_output.h5' )
45
+
46
+ config_file = 'dummy invisible_cities/config/{}.conf' .format (city )
47
+ conf = configure (config_file .split ())
48
+ conf .update (dict ( file_out = PATH_OUT
49
+ , event_range = 0 ))
50
+
51
+ module_name = f'invisible_cities.cities.{ city } '
52
+ city_function = getattr (import_module (module_name ), city )
53
+
54
+ city_function (** conf )
55
+
56
+
38
57
39
58
@mark .filterwarnings ("ignore::UserWarning" )
40
59
@mark .parametrize ("city" , all_cities )
@@ -43,22 +62,28 @@ def test_city_output_file_is_compressed(config_tmpdir, ICDATADIR, city):
43
62
config_file = 'dummy invisible_cities/config/{}.conf' .format (city )
44
63
45
64
conf = configure (config_file .split ())
46
- conf .update (dict (file_out = file_out ))
65
+ conf .update (dict ( file_out = file_out
66
+ , event_range = 0 ))
47
67
48
68
module_name = f'invisible_cities.cities.{ city } '
49
69
city_function = getattr (import_module (module_name ), city )
50
70
51
71
city_function (** conf )
52
72
73
+ checked_nodes = 0
53
74
with tb .open_file (file_out ) as file :
54
75
for node in chain ([file ], file .walk_nodes ()):
55
76
try :
56
77
assert (node .filters .complib is not None and
57
78
node .filters .complevel > 0 )
79
+ checked_nodes += 1
58
80
59
81
except tb .NoSuchNodeError :
60
82
continue
61
83
84
+ # ensure that we didn't pass the test because there were no nodes checked
85
+ assert checked_nodes > 2
86
+
62
87
63
88
@mark .filterwarnings ("ignore::UserWarning" )
64
89
@mark .parametrize ("city" , all_cities )
0 commit comments