11import pytest
22import os
33import copy
4+ import re
45
56import integrationtest .data_file_checks as data_file_checks
67import integrationtest .log_file_checks as log_file_checks
9192twobythree_ehn1_conf = copy .deepcopy (common_config_obj )
9293twobythree_ehn1_conf .session = "ehn1-local-2x3-config"
9394
94- if "cern.ch" in hostname :
95+
96+ def host_is_at_cern (hostname ):
97+ return re .match (r"^(np02|np04)-srv-\d{3}$" , hostname ) or re .match (r"^(np02|np04)-srv-\d{3}.cern.ch$" , hostname )
98+
99+
100+ if host_is_at_cern (hostname ):
95101 confgen_arguments = {
96102 "Local 1x1 Conf" : onebyone_local_conf ,
97103 "Local 2x3 Conf" : twobythree_local_conf ,
118124def test_nanorc_success (run_nanorc ):
119125 current_test = os .environ .get ("PYTEST_CURRENT_TEST" )
120126
121- if "cern.ch" not in hostname and "EHN1" in current_test :
127+ if not host_is_at_cern ( hostname ) and "EHN1" in current_test :
122128 pytest .skip (
123129 f"This computer ({ hostname } ) is not at CERN, not running EHN1 sessions"
124130 )
@@ -130,7 +136,7 @@ def test_nanorc_success(run_nanorc):
130136def test_log_files (run_nanorc ):
131137 current_test = os .environ .get ("PYTEST_CURRENT_TEST" )
132138
133- if "cern.ch" not in hostname and "EHN1" in current_test :
139+ if not host_is_at_cern ( hostname ) and "EHN1" in current_test :
134140 pytest .skip (
135141 f"This computer ({ hostname } ) is not at CERN, not running EHN1 sessions"
136142 )
@@ -160,7 +166,7 @@ def test_log_files(run_nanorc):
160166def test_data_files (run_nanorc ):
161167 current_test = os .environ .get ("PYTEST_CURRENT_TEST" )
162168
163- if "cern.ch" not in hostname and "EHN1" in current_test :
169+ if not host_is_at_cern ( hostname ) and "EHN1" in current_test :
164170 pytest .skip (
165171 f"This computer ({ hostname } ) is not at CERN, not running EHN1 sessions"
166172 )
@@ -171,7 +177,7 @@ def test_data_files(run_nanorc):
171177 "EHN1 1x1 Conf" : {"expected_fragment_count" : 4 , "expected_file_count" : 1 },
172178 "EHN1 2x3 Conf" : {"expected_fragment_count" : 8 , "expected_file_count" : 3 },
173179 }
174-
180+
175181 expected_file_count = 0
176182 expected_fragment_count = 0
177183 for key in datafile_params .keys ():
@@ -189,7 +195,7 @@ def test_data_files(run_nanorc):
189195 local_expected_event_count = expected_event_count
190196 local_event_count_tolerance = expected_event_count_tolerance
191197 fragment_check_list = [triggercandidate_frag_params , hsi_frag_params ]
192-
198+
193199 local_expected_event_count += (
194200 (6250.0 / ta_prescale )
195201 * expected_fragment_count
0 commit comments