Skip to content

Commit 1948796

Browse files
authored
Merge pull request #430 from DUNE-DAQ/kbiery/integtest_verbosity_level_ideas
Updated the change_rate_test.py to include the changes that are part …
2 parents a0de440 + 463e6e7 commit 1948796

2 files changed

Lines changed: 19 additions & 23 deletions

File tree

integtest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
Here is a sample command for invoking a test (feel free to keep or drop the options in brackets, as you prefer):
55

66
```
7-
pytest -s change_rate_test.py [--nanorc-option log-level debug] # this nanorc option is still useful even when using drunc
7+
pytest -s change_rate_test.py [--dunerc-option log-level debug]
88
```
99

1010
For reference, here are the ideas behind the existing tests:

integtest/change_rate_test.py

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44

55
import integrationtest.data_file_checks as data_file_checks
66
import integrationtest.log_file_checks as log_file_checks
7+
import integrationtest.basic_checks as basic_checks
78
import integrationtest.data_classes as data_classes
9+
from integrationtest.verbosity_helper import IntegtestVerbosityLevels
10+
11+
import functools
12+
print = functools.partial(print, flush=True) # always flush print() output
813

914
pytest_plugins = "integrationtest.integrationtest_drunc"
1015

@@ -72,7 +77,7 @@
7277

7378
# The next three variable declarations *must* be present as globals in the test
7479
# file. They're read by the "fixtures" in conftest.py to determine how
75-
# to run the config generation and nanorc
80+
# to run the config generation and drunc
7681

7782
# The arguments to pass to the config generator, excluding the json
7883
# output directory (the test framework handles that)
@@ -107,8 +112,8 @@
107112
)
108113

109114
confgen_arguments = {"MinimalSystem": conf_dict}
110-
# The commands to run in nanorc, as a list
111-
nanorc_command_list = (
115+
# The commands to run in dunerc, as a list
116+
dunerc_command_list = (
112117
"boot conf".split()
113118
+ " start --run-number 101 wait 1 enable-triggers wait 2 disable-triggers wait 2 drain-dataflow stop-trigger-sources stop wait 2".split()
114119
+ " start --run-number 102 wait 1 change-rate --trigger-rate 2.0 enable-triggers wait 1 disable-triggers wait 2 drain-dataflow stop-trigger-sources stop wait 2".split()
@@ -120,40 +125,31 @@
120125
# The tests themselves
121126

122127

123-
def test_nanorc_success(run_nanorc):
124-
# print the name of the current test
125-
current_test = os.environ.get("PYTEST_CURRENT_TEST")
126-
match_obj = re.search(r".*\[(.+)-run_.*rc.*\d].*", current_test)
127-
if match_obj:
128-
current_test = match_obj.group(1)
129-
banner_line = re.sub(".", "=", current_test)
130-
print(banner_line)
131-
print(current_test)
132-
print(banner_line)
133-
134-
# Check that nanorc completed correctly
135-
assert run_nanorc.completed_process.returncode == 0
128+
def test_dunerc_success(run_dunerc, caplog):
129+
# check for run control success, problems during pytest setup, etc.
130+
basic_checks.basic_checks(run_dunerc, caplog, print_test_name=False)
136131

137132

138-
def test_log_files(run_nanorc):
133+
def test_log_files(run_dunerc):
139134
if check_for_logfile_errors:
140135
# Check that there are no warnings or errors in the log files
141136
assert log_file_checks.logs_are_error_free(
142-
run_nanorc.log_files, True, True, ignored_logfile_problems
137+
run_dunerc.log_files, True, True, ignored_logfile_problems,
138+
verbosity_helper=run_dunerc.verbosity_helper
143139
)
144140

145141

146-
def test_data_files(run_nanorc):
142+
def test_data_files(run_dunerc):
147143
# Run some tests on the output data file
148-
assert len(run_nanorc.data_files) == expected_number_of_data_files
144+
assert len(run_dunerc.data_files) == expected_number_of_data_files
149145

150146
fragment_check_list = [triggercandidate_frag_params, hsi_frag_params]
151147
# fragment_check_list.append(wib1_frag_hsi_trig_params) # ProtoWIB
152148
# fragment_check_list.append(wib2_frag_params) # DuneWIB
153149
fragment_check_list.append(wibeth_frag_params) # WIBEth
154150

155-
for idx in range(len(run_nanorc.data_files)):
156-
data_file = data_file_checks.DataFile(run_nanorc.data_files[idx])
151+
for idx in range(len(run_dunerc.data_files)):
152+
data_file = data_file_checks.DataFile(run_dunerc.data_files[idx], run_dunerc.verbosity_helper)
157153
assert data_file_checks.sanity_check(data_file)
158154
assert data_file_checks.check_file_attributes(data_file)
159155
assert data_file_checks.check_event_count(

0 commit comments

Comments
 (0)