From 3b8ef37dabbf605f2f3d44623933802bfe3f2f3c Mon Sep 17 00:00:00 2001 From: Gitlab CI <noreply@cern.ch> Date: Sun, 24 Nov 2024 16:53:50 +0000 Subject: [PATCH] pre-commit fixes patch generated by https://gitlab.cern.ch/lhcb/LHCb/-/jobs/46438324 --- .../tests/pytest/test_event_selector.py | 5 +- .../tests/pytest/test_exec_reports_writer.py | 2 +- .../tests/pytest/test_simpleTest.py | 1 + .../tests/pytest/test_testAlgFailure.py | 7 +- Hlt/HLTScheduler/tests/pytest/test_testCF.py | 8 +- .../tests/pytest/test_testEarlyAbort.py | 8 +- .../tests/pytest/test_testLaziness.py | 4 +- .../tests/pytest/test_testNodeLogic.py | 4 +- .../tests/pytest/test_testSameNameFailure.py | 4 +- .../pytest/test_testSkipIsolatedFailures.py | 14 ++-- Hlt/HLTScheduler/tests/pytest/test_write.py | 1 + Hlt/HltDAQ/tests/options/dump.py | 7 +- .../tests/pytest/test_a_dumptolatestformat.py | 7 +- .../tests/pytest/test_b_dumpafterreformat.py | 35 +++++--- Hlt/HltDAQ/tests/pytest/test_lumi_decoding.py | 3 +- .../tests/pytest/test_assign_first_tck.py | 7 +- .../tests/pytest/test_assign_second_tck.py | 7 +- .../tests/pytest/test_make_first_tck.py | 2 + .../tests/pytest/test_make_second_tck.py | 2 + .../tests/pytest/test_muon-decoding.py | 1 + PyConf/tests/pytest/test_test_diffopts_git.py | 10 ++- .../tests/pytest/test_test_diffopts_ndiff.py | 13 +-- .../tests/pytest/test_test_diffopts_opts.py | 8 +- PyConf/tests/pytest/test_test_diffopts_pkl.py | 6 +- PyConf/tests/pytest/test_test_example.py | 24 +++--- .../pytest/test_test_example_auditors.py | 14 +++- PyConf/tests/pytest/test_test_example_pkl.py | 6 +- PyConf/tests/pytest/test_test_incomplete.py | 2 +- Pytest/python/LHCbTesting/LHCbExeTest.py | 7 +- Pytest/python/LHCbTesting/preprocessors.py | 11 ++- Pytest/python/LHCbTesting/pytest/fixtures.py | 10 +-- Pytest/python/LHCbTesting/utils.py | 7 +- ...t_test-decode-and-spacepoints-2022-data.py | 5 +- ...t_test-decode-and-spacepoints-2023-data.py | 5 +- ...t_test-decode-and-spacepoints-2024-data.py | 5 +- ..._test-decode-and-spacepoints-detdesc-mc.py | 5 +- .../test_test-instanciate-compat-old-rich1.py | 5 +- .../test_test-instanciate-compat-trunk.py | 5 +- ...test_test-radiator-volume-intersections.py | 5 +- .../pytest/test_test-run-change-2022-data.py | 5 +- .../basic_access/test_empty_tag_bare.py | 34 ++++---- .../tests/pytest/basic_access/test_files.py | 26 +++--- .../tests/pytest/basic_access/test_head.py | 36 ++++---- .../tests/pytest/basic_access/test_overlay.py | 36 ++++---- .../tests/pytest/basic_access/test_v0.py | 36 ++++---- .../tests/pytest/basic_access/test_v1.py | 36 ++++---- .../tests/pytest/basic_access/test_v1_bare.py | 42 +++++----- .../pytest/direct_mapping/test_dm_files.py | 39 +++++---- .../pytest/direct_mapping/test_dm_head.py | 48 ++++++----- .../tests/pytest/iov_access/test_iov_v0.py | 37 +++++---- .../pytest/iov_access/test_partitioning.py | 38 +++++---- .../pytest/iov_access/test_upper_limit.py | 38 +++++---- .../iov_access/test_upper_limit_error.py | 41 ++++----- .../tests/pytest/test_prepare.py | 1 + .../tests/pytest/test_run_stamp.py | 25 +++--- .../tests/pytest/test_serialize_binary.py | 1 + .../tests/pytest/test_serialize_text.py | 2 +- UT/UTDAQ/tests/pytest/test_ut_decoding.py | 3 +- VP/VPDAQ/tests/pytest/test_retina_decoding.py | 6 +- .../tests/pytest/test_retina_full_decoding.py | 7 +- utils/qmt2pytest | 83 ++++++++++--------- 61 files changed, 518 insertions(+), 384 deletions(-) diff --git a/Hlt/HLTScheduler/tests/pytest/test_event_selector.py b/Hlt/HLTScheduler/tests/pytest/test_event_selector.py index c9202ddc8b3..c9ca90ea128 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_event_selector.py +++ b/Hlt/HLTScheduler/tests/pytest/test_event_selector.py @@ -13,6 +13,7 @@ from GaudiTesting.preprocessors import SortGroupOfLines from LHCbTesting import LHCbExeTest from LHCbTesting.preprocessors import LHCbTestSuite + @pytest.mark.ctest_fixture_required('hltscheduler.write') @pytest.mark.shared_cwd('HLTScheduler') class Test(LHCbExeTest): @@ -21,6 +22,4 @@ class Test(LHCbExeTest): environment = ['GAUDIAPPNAME=', 'GAUDIAPPVERSION='] preprocessor = LHCbTestSuite + SortGroupOfLines( - r'.*INFO Event \d+ Collision number \d+' - ) - + r'.*INFO Event \d+ Collision number \d+') diff --git a/Hlt/HLTScheduler/tests/pytest/test_exec_reports_writer.py b/Hlt/HLTScheduler/tests/pytest/test_exec_reports_writer.py index 0be456e286f..b3da14a6762 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_exec_reports_writer.py +++ b/Hlt/HLTScheduler/tests/pytest/test_exec_reports_writer.py @@ -10,9 +10,9 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '../options/exec_reports_writer.py'] # TODO validate the JSON in "monitoring.json" once the sink is actually working for histograms # see https://gitlab.cern.ch/gaudi/Gaudi/-/merge_requests/1362 - diff --git a/Hlt/HLTScheduler/tests/pytest/test_simpleTest.py b/Hlt/HLTScheduler/tests/pytest/test_simpleTest.py index c0ee4d3a916..3248b7339b1 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_simpleTest.py +++ b/Hlt/HLTScheduler/tests/pytest/test_simpleTest.py @@ -10,6 +10,7 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '-v', '../options/testCF.py'] reference = {"messages_count": {}} diff --git a/Hlt/HLTScheduler/tests/pytest/test_testAlgFailure.py b/Hlt/HLTScheduler/tests/pytest/test_testAlgFailure.py index 3b79f938413..b24b9e8cf9c 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_testAlgFailure.py +++ b/Hlt/HLTScheduler/tests/pytest/test_testAlgFailure.py @@ -10,16 +10,15 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '-v', '../options/testAlgFailure.py'] returncode = 3 def test_event_failed_prompt(self, stdout: bytes): assert b"FATAL Event failed in Node consumer1" in stdout, ( - "missing fatal message from consumer1." - ) + "missing fatal message from consumer1.") def test_event_failed_prompt(self, stdout: bytes): assert b"FATAL Event failed in Node consumer2" not in stdout, ( - "consumer2 should not execute." - ) \ No newline at end of file + "consumer2 should not execute.") diff --git a/Hlt/HLTScheduler/tests/pytest/test_testCF.py b/Hlt/HLTScheduler/tests/pytest/test_testCF.py index e9e575c751f..a186ac4f626 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_testCF.py +++ b/Hlt/HLTScheduler/tests/pytest/test_testCF.py @@ -10,6 +10,7 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '-v', '../options/testCF.py'] @@ -42,11 +43,8 @@ class Test(LHCbExeTest): ] for expected_string in expected_strings: assert stdout.count(expected_string) < 4, ( - f'control flow gone wrong for {expected_string}' - ) + f'control flow gone wrong for {expected_string}') def test_node_order(self, stdout: bytes): nodeorder = b"ordered nodes: [A3, A4, A5, A1, A2, ExecReportsWriter]" - assert nodeorder in stdout, ( - 'node order is wrong' - ) + assert nodeorder in stdout, ('node order is wrong') diff --git a/Hlt/HLTScheduler/tests/pytest/test_testEarlyAbort.py b/Hlt/HLTScheduler/tests/pytest/test_testEarlyAbort.py index 71ad0bf59fe..fb85736f30d 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_testEarlyAbort.py +++ b/Hlt/HLTScheduler/tests/pytest/test_testEarlyAbort.py @@ -11,11 +11,11 @@ from LHCbTesting import LHCbExeTest from LHCbTesting.pytest.fixtures import counters + class Test(LHCbExeTest): command = ['gaudirun.py', '-v', '../options/testEarlyAbort.py'] returncode = 3 - def test_number_of_processed_events(self, stdout:bytes, counters: dict): - assert counters['HLTControlFlowMgr']['Processed events']['count'] <= 6, ( - 'Early abort did not work correctly' - ) \ No newline at end of file + def test_number_of_processed_events(self, stdout: bytes, counters: dict): + assert counters['HLTControlFlowMgr']['Processed events'][ + 'count'] <= 6, ('Early abort did not work correctly') diff --git a/Hlt/HLTScheduler/tests/pytest/test_testLaziness.py b/Hlt/HLTScheduler/tests/pytest/test_testLaziness.py index 823969b9468..fa38092d0e2 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_testLaziness.py +++ b/Hlt/HLTScheduler/tests/pytest/test_testLaziness.py @@ -10,6 +10,7 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '-v', '../options/testLaziness.py'] @@ -60,5 +61,4 @@ class Test(LHCbExeTest): for expected_string in expected_strings: assert stdout.decode().count(expected_string) >= 4, ( - f'shortcircuiting gone wrong for {expected_string}' - ) + f'shortcircuiting gone wrong for {expected_string}') diff --git a/Hlt/HLTScheduler/tests/pytest/test_testNodeLogic.py b/Hlt/HLTScheduler/tests/pytest/test_testNodeLogic.py index 4812112719a..7a1ca25913b 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_testNodeLogic.py +++ b/Hlt/HLTScheduler/tests/pytest/test_testNodeLogic.py @@ -10,6 +10,7 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '-v', '../options/testNodeLogic.py'] @@ -72,5 +73,4 @@ class Test(LHCbExeTest): for expected_string in expected_strings: assert stdout.decode().count(expected_string) >= 4, ( - f'control flow gone wrong for {expected_string}' - ) \ No newline at end of file + f'control flow gone wrong for {expected_string}') diff --git a/Hlt/HLTScheduler/tests/pytest/test_testSameNameFailure.py b/Hlt/HLTScheduler/tests/pytest/test_testSameNameFailure.py index 357b8b71508..afb9c38d9d3 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_testSameNameFailure.py +++ b/Hlt/HLTScheduler/tests/pytest/test_testSameNameFailure.py @@ -10,11 +10,11 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '-v', '../options/testSameNameFailure.py'] returncode = 1 def test_error_message(self, stdout: bytes): assert b'node with name line1 defined twice.' in stdout, ( - 'error message missing.' - ) \ No newline at end of file + 'error message missing.') diff --git a/Hlt/HLTScheduler/tests/pytest/test_testSkipIsolatedFailures.py b/Hlt/HLTScheduler/tests/pytest/test_testSkipIsolatedFailures.py index 3243e025072..b53095f5fec 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_testSkipIsolatedFailures.py +++ b/Hlt/HLTScheduler/tests/pytest/test_testSkipIsolatedFailures.py @@ -11,15 +11,15 @@ from LHCbTesting import LHCbExeTest from LHCbTesting.pytest.fixtures import counters + class Test(LHCbExeTest): command = ['gaudirun.py', '-v', '../options/testSkipIsolatedFailures.py'] - def test_number_of_processed_events(self, stdout:bytes, counters: dict): - assert counters['HLTControlFlowMgr']['Processed events']['count'] == 100, ( - 'Number of processed events incorrect (should be 100)' - ) + def test_number_of_processed_events(self, stdout: bytes, counters: dict): + assert counters['HLTControlFlowMgr']['Processed events'][ + 'count'] == 100, ( + 'Number of processed events incorrect (should be 100)') - def test_number_of_failed_events(self, stdout:bytes, counters: dict): + def test_number_of_failed_events(self, stdout: bytes, counters: dict): assert counters['HLTControlFlowMgr']['Failed events']['count'] == 10, ( - 'Number of failed events incorrect (should be 10)' - ) \ No newline at end of file + 'Number of failed events incorrect (should be 10)') diff --git a/Hlt/HLTScheduler/tests/pytest/test_write.py b/Hlt/HLTScheduler/tests/pytest/test_write.py index bcabbd9bd7a..982b7802207 100644 --- a/Hlt/HLTScheduler/tests/pytest/test_write.py +++ b/Hlt/HLTScheduler/tests/pytest/test_write.py @@ -11,6 +11,7 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_setup('hltscheduler.write') @pytest.mark.shared_cwd('HLTScheduler') class Test(LHCbExeTest): diff --git a/Hlt/HltDAQ/tests/options/dump.py b/Hlt/HltDAQ/tests/options/dump.py index be259815df5..048daf468f4 100644 --- a/Hlt/HltDAQ/tests/options/dump.py +++ b/Hlt/HltDAQ/tests/options/dump.py @@ -17,9 +17,10 @@ options.evt_max = 10 options.set_input_and_conds_from_testfiledb("2012_raw_default") options.input_files = ["rewritten.mdf"] -dump = RawEventDump(RawBanks=["HltSelReports", "HltDecReports"], - RawEventLocations=["/Event/DAQ/RawEvent"], - DumpData=True) +dump = RawEventDump( + RawBanks=["HltSelReports", "HltDecReports"], + RawEventLocations=["/Event/DAQ/RawEvent"], + DumpData=True) node = CompositeNode("Seq", children=[dump]) config = configure_input(options) diff --git a/Hlt/HltDAQ/tests/pytest/test_a_dumptolatestformat.py b/Hlt/HltDAQ/tests/pytest/test_a_dumptolatestformat.py index a3e3bcde804..8590a070a76 100644 --- a/Hlt/HltDAQ/tests/pytest/test_a_dumptolatestformat.py +++ b/Hlt/HltDAQ/tests/pytest/test_a_dumptolatestformat.py @@ -11,17 +11,22 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_setup("hltdaq.a_dumptolatestformat") @pytest.mark.shared_cwd("HltDAQ") class Test(LHCbExeTest): command = ["gaudirun.py", "../options/dump_decode_wipe_encode_split.py"] reference = {"messages_count": {"FATAL": 0, "ERROR": 4, "WARNING": 28}} + # Author: rlambert # Purpose: to check if bank encoder changes are binary compatible # Common failure modes, severities and cures: see dumpafterreformat.qmt def test_save_stdout(self, stdout: bytes): - stdout = [s.strip() for s in stdout.decode().split("\n") if "RawEventDump" in s] + stdout = [ + s.strip() for s in stdout.decode().split("\n") + if "RawEventDump" in s + ] f = open("hltdaq.dump.previous.stdout", "w") f.write("\n".join(stdout) + "\n") f.close() diff --git a/Hlt/HltDAQ/tests/pytest/test_b_dumpafterreformat.py b/Hlt/HltDAQ/tests/pytest/test_b_dumpafterreformat.py index 74958a25ea3..efa9a3e2efd 100644 --- a/Hlt/HltDAQ/tests/pytest/test_b_dumpafterreformat.py +++ b/Hlt/HltDAQ/tests/pytest/test_b_dumpafterreformat.py @@ -11,11 +11,13 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required("hltdaq.a_dumptolatestformat") @pytest.mark.shared_cwd("HltDAQ") class Test(LHCbExeTest): command = ["gaudirun.py", "../options/dump.py"] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} + # Author: rlambert # Purpose: to check if bank encoder changes are binary compatible # Common failure modes, severities and cures: @@ -40,26 +42,28 @@ class Test(LHCbExeTest): # exceptions: HltSelReports vary due to non-deterministic re-sorting exceptions = [ - p - for p in stdout + p for p in stdout if p not in prevstdout and "[10] [1c445] [b] [c] [d] [e] [10]" in p ] exceptions = exceptions + [ - p - for p in prevstdout + p for p in prevstdout if p not in stdout and "[10] [1c445] [b] [c] [d] [e] [10]" in p ] # MCat-20150108 (+SB-20160912) Next two are temporary, in transition from version 2 (last Run 1) to version 9 (latest Run 2) of SelReports bank exceptions = exceptions + [ - p for p in stdout if p not in prevstdout and "[64, 0, 11, cbcb]" in p + p + for p in stdout if p not in prevstdout and "[64, 0, 11, cbcb]" in p ] exceptions = exceptions + [ - p for p in prevstdout if p not in stdout and "[64, 0, 2, cbcb]" in p + p + for p in prevstdout if p not in stdout and "[64, 0, 2, cbcb]" in p ] newlines = [ p for p in stdout if p not in prevstdout and p not in exceptions ] - missing = [p for p in prevstdout if p not in stdout and p not in exceptions] + missing = [ + p for p in prevstdout if p not in stdout and p not in exceptions + ] # copy both as new references if len(newlines + missing): import os @@ -81,15 +85,20 @@ class Test(LHCbExeTest): "+ " + newlines[i] + "\n- " + missing[i] for i in range(len(newlines)) ] - result["hltdaq.dumpafterreformat"] = result.Quote("\n".join(printme)) + result["hltdaq.dumpafterreformat"] = result.Quote( + "\n".join(printme)) elif len(newlines): printme = ["+ " + newlines[i] for i in range(len(newlines))] - printme = printme + ["- " + missing[i] for i in range(len(missing))] - result["hltdaq.dumpafterreformat"] = result.Quote("\n".join(printme)) + printme = printme + [ + "- " + missing[i] for i in range(len(missing)) + ] + result["hltdaq.dumpafterreformat"] = result.Quote( + "\n".join(printme)) if len(exceptions): printme = ["+ " + ex for ex in exceptions if ex in stdout] - printme = printme + ["- " + ex for ex in exceptions if ex in prevstdout] + printme = printme + [ + "- " + ex for ex in exceptions if ex in prevstdout + ] result["hltdaq.dumpafterreformat.excluded"] = result.Quote( - "\n".join(printme) - ) + "\n".join(printme)) diff --git a/Hlt/HltDAQ/tests/pytest/test_lumi_decoding.py b/Hlt/HltDAQ/tests/pytest/test_lumi_decoding.py index f3f9189823b..4e39536171f 100644 --- a/Hlt/HltDAQ/tests/pytest/test_lumi_decoding.py +++ b/Hlt/HltDAQ/tests/pytest/test_lumi_decoding.py @@ -10,6 +10,7 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ["gaudirun.py", "../options/lumi_decoding.py"] - reference = "../refs/lumi_decoding.yaml" \ No newline at end of file + reference = "../refs/lumi_decoding.yaml" diff --git a/Hlt/HltServices/tests/pytest/test_assign_first_tck.py b/Hlt/HltServices/tests/pytest/test_assign_first_tck.py index 4a258ad5d5a..e8a8e58686f 100644 --- a/Hlt/HltServices/tests/pytest/test_assign_first_tck.py +++ b/Hlt/HltServices/tests/pytest/test_assign_first_tck.py @@ -11,17 +11,20 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required("hltservices.make_first_tck") @pytest.mark.ctest_fixture_setup("hltservices.assign_first_tck") @pytest.mark.shared_cwd("HltServices") class Test(LHCbExeTest): command = ["python", "../options/assign_tck.py", "0x11291600"] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} + # Author: Roel Aaij def test_config_created(self, stdout): - assert (b"ConfigCDBAccessSvc INFO opening TCKData/config.cdb in mode ReadWrite\n" - b"ConfigCDBAccessSvc INFO created AL/TCK/0x11291600") in stdout + assert ( + b"ConfigCDBAccessSvc INFO opening TCKData/config.cdb in mode ReadWrite\n" + b"ConfigCDBAccessSvc INFO created AL/TCK/0x11291600") in stdout def test_stdout(self, stdout: bytes): assert b"PASSED" in stdout diff --git a/Hlt/HltServices/tests/pytest/test_assign_second_tck.py b/Hlt/HltServices/tests/pytest/test_assign_second_tck.py index 2bd8435131c..2429402a103 100644 --- a/Hlt/HltServices/tests/pytest/test_assign_second_tck.py +++ b/Hlt/HltServices/tests/pytest/test_assign_second_tck.py @@ -11,17 +11,20 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required("hltservices.make_second_tck") @pytest.mark.shared_cwd("HltServices") class Test(LHCbExeTest): command = ["python", "../options/assign_tck.py", "0x11291603"] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} + # Author: Roel Aaij # Purpose: Assign a TCK label to the TCK to test the closing of config.cdb file def test_config_created(self, stdout): - assert (b"ConfigCDBAccessSvc INFO opening TCKData/config.cdb in mode ReadWrite\n" - b"ConfigCDBAccessSvc INFO created AL/TCK/0x11291603") in stdout + assert ( + b"ConfigCDBAccessSvc INFO opening TCKData/config.cdb in mode ReadWrite\n" + b"ConfigCDBAccessSvc INFO created AL/TCK/0x11291603") in stdout def test_stdout(self, stdout: bytes): assert b"PASSED" in stdout diff --git a/Hlt/HltServices/tests/pytest/test_make_first_tck.py b/Hlt/HltServices/tests/pytest/test_make_first_tck.py index acd0cd40b5b..9567734168b 100644 --- a/Hlt/HltServices/tests/pytest/test_make_first_tck.py +++ b/Hlt/HltServices/tests/pytest/test_make_first_tck.py @@ -11,11 +11,13 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_setup("hltservices.make_first_tck") @pytest.mark.shared_cwd("HltServices") class Test(LHCbExeTest): command = ["python", "../options/make_tck.py", "--clear", "0.1"] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 2}} + # Author: Roel Aaij def test_config_created(self, stdout: bytes): diff --git a/Hlt/HltServices/tests/pytest/test_make_second_tck.py b/Hlt/HltServices/tests/pytest/test_make_second_tck.py index d7b5a9592ac..91a729334dd 100644 --- a/Hlt/HltServices/tests/pytest/test_make_second_tck.py +++ b/Hlt/HltServices/tests/pytest/test_make_second_tck.py @@ -11,12 +11,14 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required("hltservices.assign_first_tck") @pytest.mark.ctest_fixture_setup("hltservices.make_second_tck") @pytest.mark.shared_cwd("HltServices") class Test(LHCbExeTest): command = ["python", "../options/make_tck.py", "0.5"] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 2}} + # Author: Roel Aaij # Purpose: Make the TCK needed to test the closing of the config.cdb file diff --git a/Muon/MuonDAQ/tests/pytest/test_muon-decoding.py b/Muon/MuonDAQ/tests/pytest/test_muon-decoding.py index 606b1da0c0f..0f8b67129f1 100644 --- a/Muon/MuonDAQ/tests/pytest/test_muon-decoding.py +++ b/Muon/MuonDAQ/tests/pytest/test_muon-decoding.py @@ -10,6 +10,7 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '../options/decoding.py'] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} diff --git a/PyConf/tests/pytest/test_test_diffopts_git.py b/PyConf/tests/pytest/test_test_diffopts_git.py index 7d7355c401a..ac13a0d16a8 100644 --- a/PyConf/tests/pytest/test_test_diffopts_git.py +++ b/PyConf/tests/pytest/test_test_diffopts_git.py @@ -12,10 +12,14 @@ from GaudiTesting.preprocessors import LineSkipper from LHCbTesting.preprocessors import LHCbTestSuite from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['diffopts.py', '-e=Audit.*', '-e=(?!ApplicationMgr),.*', '--git', '../pytest/data/brunel.opts.py', '../pytest/data/moore.opts.py'] + command = [ + 'diffopts.py', '-e=Audit.*', '-e=(?!ApplicationMgr),.*', '--git', + '../pytest/data/brunel.opts.py', '../pytest/data/moore.opts.py' + ] reference = '../refs/diffopts_git.yaml' returncode = 1 - preprocessor = (LHCbTestSuite + - LineSkipper(regexps=[r'^(diff --git|---|\+\+\+) .*(brunel|moore)\.opts\.py.*'])) + preprocessor = (LHCbTestSuite + LineSkipper( + regexps=[r'^(diff --git|---|\+\+\+) .*(brunel|moore)\.opts\.py.*'])) diff --git a/PyConf/tests/pytest/test_test_diffopts_ndiff.py b/PyConf/tests/pytest/test_test_diffopts_ndiff.py index bed9c29eefe..93c5435e86f 100644 --- a/PyConf/tests/pytest/test_test_diffopts_ndiff.py +++ b/PyConf/tests/pytest/test_test_diffopts_ndiff.py @@ -12,13 +12,14 @@ from GaudiTesting.preprocessors import LineSkipper from LHCbTesting.preprocessors import LHCbTestSuite from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['diffopts.py', '--ndiff', '../pytest/data/brunel.opts.py', '../pytest/data/moore.opts.py'] + command = [ + 'diffopts.py', '--ndiff', '../pytest/data/brunel.opts.py', + '../pytest/data/moore.opts.py' + ] reference = '../refs/diffopts_ndiff.yaml' returncode = 1 - preprocessor = (LHCbTestSuite + - LineSkipper(regexps=[r'^(---|\+\+\+).*(brunel|moore)\.opts\.py$'])) - - - + preprocessor = (LHCbTestSuite + LineSkipper( + regexps=[r'^(---|\+\+\+).*(brunel|moore)\.opts\.py$'])) diff --git a/PyConf/tests/pytest/test_test_diffopts_opts.py b/PyConf/tests/pytest/test_test_diffopts_opts.py index 6c50688a965..a66d4dc49f7 100644 --- a/PyConf/tests/pytest/test_test_diffopts_opts.py +++ b/PyConf/tests/pytest/test_test_diffopts_opts.py @@ -10,8 +10,12 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['diffopts.py', '../pytest/data/moore.opts.opts', '../pytest/data/moore.opts.py'] + command = [ + 'diffopts.py', '../pytest/data/moore.opts.opts', + '../pytest/data/moore.opts.py' + ] def test_stdout(self, stdout: bytes): - assert not stdout, 'non-empty stdout' \ No newline at end of file + assert not stdout, 'non-empty stdout' diff --git a/PyConf/tests/pytest/test_test_diffopts_pkl.py b/PyConf/tests/pytest/test_test_diffopts_pkl.py index 6110ec6687e..af2d9495d2a 100644 --- a/PyConf/tests/pytest/test_test_diffopts_pkl.py +++ b/PyConf/tests/pytest/test_test_diffopts_pkl.py @@ -11,11 +11,15 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('pyconf.test_example') @pytest.mark.ctest_fixture_required('pyconf.test_example_pkl') @pytest.mark.shared_cwd('PyConf') class Test(LHCbExeTest): - command = ['diffopts.py', '--exclude=HltANNSvc,^Repositories$', 'example.opts.pkl', 'example.opts.py'] + command = [ + 'diffopts.py', '--exclude=HltANNSvc,^Repositories$', + 'example.opts.pkl', 'example.opts.py' + ] def test_stdout(self, stdout: bytes): assert not stdout, 'non-empty stdout' diff --git a/PyConf/tests/pytest/test_test_example.py b/PyConf/tests/pytest/test_test_example.py index 1dc4055481b..8844653c5af 100644 --- a/PyConf/tests/pytest/test_test_example.py +++ b/PyConf/tests/pytest/test_test_example.py @@ -13,35 +13,33 @@ import pytest from pathlib import Path from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_setup('pyconf.test_example') @pytest.mark.shared_cwd('PyConf') class Test(LHCbExeTest): - command = ['gaudirun.py', '../../options/example.py', '--output=example.opts.py', '--all-opts'] + command = [ + 'gaudirun.py', '../../options/example.py', '--output=example.opts.py', + '--all-opts' + ] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} def test_intdata_producer(self, stdout: bytes): # The second instance of IntDataProducer should be in DEBUG assert not b"+ OUTPUT '/Event/Gaudi__Examples__IntDataProducer_645a4107/OutputLocation" in stdout, ( - "Incorrect configuration of first IntDataProducer" - ) + "Incorrect configuration of first IntDataProducer") assert b"+ OUTPUT '/Event/Gaudi__Examples__IntDataProducer_20b0013b/OutputLocation'" in stdout, ( - "Incorrect configuration of second IntDataProducer" - ) + "Incorrect configuration of second IntDataProducer") # Shouldn't have more than 2 IntDataProducers assert stdout.count(b'| "Gaudi__Examples__IntDataProducer') == 2, ( - "Deduplication of IntDataProducer failed" - ) + "Deduplication of IntDataProducer failed") def test_order_of_values(self, stdout: bytes): # Should see correct order of values (first overridden, then default) assert b"Got value 123\nGot value 1\n" in stdout, ( - "Bind override of int_maker failed" - ) + "Bind override of int_maker failed") def test_monitoring_json(self, cwd: Path): # test if monitoring.json is produced print(os.listdir('.')) - assert os.path.isfile(cwd / "monitoring.json"), ( - "monitoring.json was not produced" - ) - + assert os.path.isfile( + cwd / "monitoring.json"), ("monitoring.json was not produced") diff --git a/PyConf/tests/pytest/test_test_example_auditors.py b/PyConf/tests/pytest/test_test_example_auditors.py index 56d5ea00667..9f12634b7d0 100644 --- a/PyConf/tests/pytest/test_test_example_auditors.py +++ b/PyConf/tests/pytest/test_test_example_auditors.py @@ -11,12 +11,18 @@ import re from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '../../options/example_auditors.py', '--output=example_auditors.opts.py', '--all-opts'] + command = [ + 'gaudirun.py', '../../options/example_auditors.py', + '--output=example_auditors.opts.py', '--all-opts' + ] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} def test_stdout(self, stdout: bytes): - auditor_enter = re.search(rb"NameAuditor\s+INFO About to Enter .* with auditor trigger", stdout) - auditor_exit = re.search(rb"NameAuditor\s+INFO Just Exited .* with auditor trigger", stdout) + auditor_enter = re.search( + rb"NameAuditor\s+INFO About to Enter .* with auditor trigger", + stdout) + auditor_exit = re.search( + rb"NameAuditor\s+INFO Just Exited .* with auditor trigger", stdout) assert auditor_enter and auditor_exit, "NameAuditor output not found" - diff --git a/PyConf/tests/pytest/test_test_example_pkl.py b/PyConf/tests/pytest/test_test_example_pkl.py index d7f2167f26f..e5805de309d 100644 --- a/PyConf/tests/pytest/test_test_example_pkl.py +++ b/PyConf/tests/pytest/test_test_example_pkl.py @@ -11,7 +11,11 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_setup('pyconf.test_example_pkl') @pytest.mark.shared_cwd('PyConf') class Test(LHCbExeTest): - command = ['gaudirun.py', '../../options/example.py', '-n', '--output=example.opts.pkl', '--all-opts'] + command = [ + 'gaudirun.py', '../../options/example.py', '-n', + '--output=example.opts.pkl', '--all-opts' + ] diff --git a/PyConf/tests/pytest/test_test_incomplete.py b/PyConf/tests/pytest/test_test_incomplete.py index 82cc0986413..e3dbb3ba06c 100644 --- a/PyConf/tests/pytest/test_test_incomplete.py +++ b/PyConf/tests/pytest/test_test_incomplete.py @@ -10,6 +10,7 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '../options/incomplete.py'] returncode = 1 @@ -21,4 +22,3 @@ class Test(LHCbExeTest): else: expected = b"Required options not set: ['input_type', 'geometry_version', 'conditions_version']" assert expected in stderr, "ConfigurationError not raised" - diff --git a/Pytest/python/LHCbTesting/LHCbExeTest.py b/Pytest/python/LHCbTesting/LHCbExeTest.py index 0f58dbe947b..74a52c06e63 100644 --- a/Pytest/python/LHCbTesting/LHCbExeTest.py +++ b/Pytest/python/LHCbTesting/LHCbExeTest.py @@ -19,6 +19,7 @@ from GaudiTesting.utils import filter_dict from LHCbTesting.utils import find_counters_summaries from LHCbTesting.preprocessors import LHCbTestSuite + class LHCbExeTest(GaudiExeTest): """ An extension of GaudiExeTest tailored to the LHCb projects workflow. @@ -29,7 +30,9 @@ class LHCbExeTest(GaudiExeTest): @pytest.mark.do_not_collect_source def test_counters( - self, stdout: bytes, reference: Dict #, record_property: Callable + self, + stdout: bytes, + reference: Dict #, record_property: Callable ) -> None: """ Test the counters summaries against the reference. @@ -48,4 +51,4 @@ class LHCbExeTest(GaudiExeTest): reference["counters"] = counters if os.environ.get("GAUDI_TEST_IGNORE_STDOUT_VALIDATION") == "1": pytest.xfail("Ignoring stdout validation") - raise \ No newline at end of file + raise diff --git a/Pytest/python/LHCbTesting/preprocessors.py b/Pytest/python/LHCbTesting/preprocessors.py index 7e33b350390..81a2094e501 100644 --- a/Pytest/python/LHCbTesting/preprocessors.py +++ b/Pytest/python/LHCbTesting/preprocessors.py @@ -8,9 +8,9 @@ # granted to it by virtue of its status as an Intergovernmental Organization # # or submit itself to any jurisdiction. # ############################################################################### -from GaudiTesting.preprocessors import (normalizeTestSuite, - RegexpReplacer, LineSkipper, - SortGroupOfLines, BlockSkipper) +from GaudiTesting.preprocessors import (normalizeTestSuite, RegexpReplacer, + LineSkipper, SortGroupOfLines, + BlockSkipper) from DDDB.CheckDD4Hep import UseDD4Hep @@ -40,7 +40,7 @@ if UseDD4Hep: ]) LHCbTestSuite = ( - normalizeTestSuite + # workaround for gaudi/Gaudi#108 + normalizeTestSuite + # workaround for gaudi/Gaudi#108 RegexpReplacer( # normalize full path to DBASE or PARAM orig=r'/[^ :]+/(DBASE|PARAM)/', repl=r'\1/', @@ -174,8 +174,7 @@ LHCbTestSuite = ( when="StoreExplorerAlg", orig=r'LHCb::ODINImplementation::v7::OD', repl=r'LHCb::ODIN', - ) + - RegexpReplacer(r"(\t)", r" ") + + ) + RegexpReplacer(r"(\t)", r" ") + #RegexpReplacer( # "Added successfully Conversion service:", # "Added successfully Conversion service:", diff --git a/Pytest/python/LHCbTesting/pytest/fixtures.py b/Pytest/python/LHCbTesting/pytest/fixtures.py index 079a7aadbf8..94ca73c5900 100644 --- a/Pytest/python/LHCbTesting/pytest/fixtures.py +++ b/Pytest/python/LHCbTesting/pytest/fixtures.py @@ -12,19 +12,17 @@ import subprocess import pytest from typing import Generator -from LHCbTesting.utils import ( - find_counters_summaries -) +from LHCbTesting.utils import (find_counters_summaries) # Extra plugin for LHCb applications # The fixtures include: # - capture_counters: Captures counters in standard output + @pytest.fixture(scope="class") -def counters( - completed_process: subprocess.CompletedProcess -) -> Generator[dict, None, None]: +def counters(completed_process: subprocess.CompletedProcess + ) -> Generator[dict, None, None]: stdout = completed_process.stdout if completed_process else None counters = find_counters_summaries(stdout) diff --git a/Pytest/python/LHCbTesting/utils.py b/Pytest/python/LHCbTesting/utils.py index bfda30c2b14..7c61af328a8 100644 --- a/Pytest/python/LHCbTesting/utils.py +++ b/Pytest/python/LHCbTesting/utils.py @@ -13,13 +13,15 @@ import re # Signature of the print-out of Counters c_count_re = re.compile(r"^(.*)INFO\s*Number\s*of\s*counters\s*:\s*(\d+)") + def _parse_counters_summary(lines, pos): """ Parse the Counters summary table starting from pos. Returns a tuple with the dictionary with the digested information. """ result = {} - header_match = re.match(r'\s*(\w+)\s+(\w+)\s+Number of counters\s*:\s*(\d+)', lines[pos]) + header_match = re.match( + r'\s*(\w+)\s+(\w+)\s+Number of counters\s*:\s*(\d+)', lines[pos]) if not header_match: raise ValueError("Invalid header format") @@ -32,7 +34,7 @@ def _parse_counters_summary(lines, pos): } } # Parse counter data - for line in lines[pos+2: pos+2+total_counters]: + for line in lines[pos + 2:pos + 2 + total_counters]: if not line.startswith(" |"): raise AssertionError("Declared incorrect number of counters") parts = re.split(r'\|', line.strip()) @@ -57,6 +59,7 @@ def _parse_counters_summary(lines, pos): counter_info[title][counter["name"]] = counter return counter_info + def find_counters_summaries(stdout): """ Scan stdout to find counters summaries and digest them. diff --git a/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2022-data.py b/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2022-data.py index cfd3466ea64..8ef66f5f79e 100644 --- a/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2022-data.py +++ b/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2022-data.py @@ -10,7 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '../options/decode-and-spacepoints.py:run2022Data'] + command = [ + 'gaudirun.py', '../options/decode-and-spacepoints.py:run2022Data' + ] reference = '../refs/decode-and-spacepoints-2022-data.yaml' timeout = 600 diff --git a/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2023-data.py b/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2023-data.py index b6d00090089..20df62957d3 100644 --- a/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2023-data.py +++ b/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2023-data.py @@ -10,7 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '../options/decode-and-spacepoints.py:run2023Data'] + command = [ + 'gaudirun.py', '../options/decode-and-spacepoints.py:run2023Data' + ] reference = '../refs/decode-and-spacepoints-2023-data.yaml' timeout = 600 diff --git a/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2024-data.py b/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2024-data.py index 6f7069420d8..6b1aa504958 100644 --- a/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2024-data.py +++ b/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-2024-data.py @@ -10,7 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '../options/decode-and-spacepoints.py:run2024Data'] + command = [ + 'gaudirun.py', '../options/decode-and-spacepoints.py:run2024Data' + ] reference = '../refs/decode-and-spacepoints-2024-data.yaml' timeout = 600 diff --git a/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-detdesc-mc.py b/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-detdesc-mc.py index 7fe82e55a66..87d2efd7e7c 100644 --- a/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-detdesc-mc.py +++ b/Rich/RichDetectors/tests/pytest/test_test-decode-and-spacepoints-detdesc-mc.py @@ -10,7 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '../options/decode-and-spacepoints.py:runDetDescCompat'] + command = [ + 'gaudirun.py', '../options/decode-and-spacepoints.py:runDetDescCompat' + ] reference = '../refs/decode-and-spacepoints-detdesc-mc.yaml' timeout = 600 diff --git a/Rich/RichDetectors/tests/pytest/test_test-instanciate-compat-old-rich1.py b/Rich/RichDetectors/tests/pytest/test_test-instanciate-compat-old-rich1.py index 06453a5585c..a09a174da62 100644 --- a/Rich/RichDetectors/tests/pytest/test_test-instanciate-compat-old-rich1.py +++ b/Rich/RichDetectors/tests/pytest/test_test-instanciate-compat-old-rich1.py @@ -10,7 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '../options/decode-and-spacepoints.py:runCompatOld'] + command = [ + 'gaudirun.py', '../options/decode-and-spacepoints.py:runCompatOld' + ] reference = '../refs/instanciate-compat-old-rich1.yaml' timeout = 600 diff --git a/Rich/RichDetectors/tests/pytest/test_test-instanciate-compat-trunk.py b/Rich/RichDetectors/tests/pytest/test_test-instanciate-compat-trunk.py index 47c3b968772..d94eae9ebcb 100644 --- a/Rich/RichDetectors/tests/pytest/test_test-instanciate-compat-trunk.py +++ b/Rich/RichDetectors/tests/pytest/test_test-instanciate-compat-trunk.py @@ -10,7 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '../options/decode-and-spacepoints.py:runCompatTrunk'] + command = [ + 'gaudirun.py', '../options/decode-and-spacepoints.py:runCompatTrunk' + ] reference = '../refs/instanciate-compat-trunk.yaml' timeout = 600 diff --git a/Rich/RichDetectors/tests/pytest/test_test-radiator-volume-intersections.py b/Rich/RichDetectors/tests/pytest/test_test-radiator-volume-intersections.py index 0c2b3f0ad2b..718944ef725 100644 --- a/Rich/RichDetectors/tests/pytest/test_test-radiator-volume-intersections.py +++ b/Rich/RichDetectors/tests/pytest/test_test-radiator-volume-intersections.py @@ -10,7 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '../options/decode-and-spacepoints.py:runRadInter'] + command = [ + 'gaudirun.py', '../options/decode-and-spacepoints.py:runRadInter' + ] reference = '../refs/radiator-volume-intersections.yaml' timeout = 600 diff --git a/Rich/RichDetectors/tests/pytest/test_test-run-change-2022-data.py b/Rich/RichDetectors/tests/pytest/test_test-run-change-2022-data.py index 274de9d2dd5..c92fd0ae565 100644 --- a/Rich/RichDetectors/tests/pytest/test_test-run-change-2022-data.py +++ b/Rich/RichDetectors/tests/pytest/test_test-run-change-2022-data.py @@ -10,7 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '../options/decode-and-spacepoints.py:runMultipleRuns'] + command = [ + 'gaudirun.py', '../options/decode-and-spacepoints.py:runMultipleRuns' + ] reference = '../refs/test-run-change-2022-data.yaml' timeout = 600 diff --git a/Tools/GitEntityResolver/tests/pytest/basic_access/test_empty_tag_bare.py b/Tools/GitEntityResolver/tests/pytest/basic_access/test_empty_tag_bare.py index fb9297af6cf..cbf3e2ca3b2 100644 --- a/Tools/GitEntityResolver/tests/pytest/basic_access/test_empty_tag_bare.py +++ b/Tools/GitEntityResolver/tests/pytest/basic_access/test_empty_tag_bare.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -32,12 +33,17 @@ class Test(LHCbExeTest): from subprocess import check_output tag = 'HEAD' repository = os.environ['GIT_TEST_REPOSITORY'] + '-bare.git' - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 0 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -45,22 +51,22 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) + LHCbExeTest.find_reference_block( + ''' --- /dd/TestCondition Validity: 0.0 -> 9223372036.854775807 (int) parameter = {parameter} '''.format(parameter=parameter), stdout=stripped_output, - id='condition_value' - ) + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/basic_access/test_files.py b/Tools/GitEntityResolver/tests/pytest/basic_access/test_files.py index d3002d6a15e..c78a13dcb10 100644 --- a/Tools/GitEntityResolver/tests/pytest/basic_access/test_files.py +++ b/Tools/GitEntityResolver/tests/pytest/basic_access/test_files.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -34,7 +35,8 @@ class Test(LHCbExeTest): commit_id = None parameter = -123 - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using checked out files in {repository} @@ -42,25 +44,23 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(repository=repository, commit_id=commit_id, tag=tag), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag} '''.format(repository=repository, commit_id=commit_id, tag=tag), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/TestCondition Validity: 0.0 -> 9223372036.854775807 (int) parameter = {parameter} '''.format(parameter=parameter), stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/basic_access/test_head.py b/Tools/GitEntityResolver/tests/pytest/basic_access/test_head.py index eeefaec59ee..f18e3b825bb 100644 --- a/Tools/GitEntityResolver/tests/pytest/basic_access/test_head.py +++ b/Tools/GitEntityResolver/tests/pytest/basic_access/test_head.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -33,12 +34,17 @@ class Test(LHCbExeTest): tag = 'HEAD' repository = os.environ['GIT_TEST_REPOSITORY'] - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 0 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -46,25 +52,23 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/TestCondition Validity: 0.0 -> 9223372036.854775807 (int) parameter = {parameter} '''.format(parameter=parameter), stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/basic_access/test_overlay.py b/Tools/GitEntityResolver/tests/pytest/basic_access/test_overlay.py index b9c8706cf9c..beb8c19b16d 100644 --- a/Tools/GitEntityResolver/tests/pytest/basic_access/test_overlay.py +++ b/Tools/GitEntityResolver/tests/pytest/basic_access/test_overlay.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -32,13 +33,18 @@ class Test(LHCbExeTest): from subprocess import check_output tag = 'HEAD' repository = os.environ['GIT_TEST_REPOSITORY'] - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 777 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -46,25 +52,23 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/TestCondition Validity: 0.0 -> 9223372036.854775807 (int) parameter = {parameter} '''.format(parameter=parameter), stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/basic_access/test_v0.py b/Tools/GitEntityResolver/tests/pytest/basic_access/test_v0.py index e09e84f2864..783a9580d69 100644 --- a/Tools/GitEntityResolver/tests/pytest/basic_access/test_v0.py +++ b/Tools/GitEntityResolver/tests/pytest/basic_access/test_v0.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -32,13 +33,18 @@ class Test(LHCbExeTest): from subprocess import check_output tag = 'v0' repository = os.environ['GIT_TEST_REPOSITORY'] - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 42 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -46,25 +52,23 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/TestCondition Validity: 0.0 -> 9223372036.854775807 (int) parameter = {parameter} '''.format(parameter=parameter), stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/basic_access/test_v1.py b/Tools/GitEntityResolver/tests/pytest/basic_access/test_v1.py index dc7400bcc67..de14b6689a5 100644 --- a/Tools/GitEntityResolver/tests/pytest/basic_access/test_v1.py +++ b/Tools/GitEntityResolver/tests/pytest/basic_access/test_v1.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -32,12 +33,17 @@ class Test(LHCbExeTest): from subprocess import check_output tag = 'v1' repository = os.environ['GIT_TEST_REPOSITORY'] - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 2016 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -45,25 +51,23 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/TestCondition Validity: 0.0 -> 9223372036.854775807 (int) parameter = {parameter} '''.format(parameter=parameter), stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/basic_access/test_v1_bare.py b/Tools/GitEntityResolver/tests/pytest/basic_access/test_v1_bare.py index 39888cd21ba..91376532e59 100644 --- a/Tools/GitEntityResolver/tests/pytest/basic_access/test_v1_bare.py +++ b/Tools/GitEntityResolver/tests/pytest/basic_access/test_v1_bare.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -32,12 +33,17 @@ class Test(LHCbExeTest): from subprocess import check_output tag = 'v1' repository = os.environ['GIT_TEST_REPOSITORY'] + '-bare.git' - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 2016 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -45,35 +51,33 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' DetCondTest::Te... INFO /dd/TestCondition was updated LoadDDDB INFO Loading the DDDB ToolSvc.GitDDDB DEBUG resolveEntity(systemId = "git:/changing.xml") ToolSvc.GitDDDB DEBUG open("git:/changing.xml") ToolSvc.GitDDDB DEBUG opening Git repository '{repository}' '''.format(repository=repository), - id='GitEntityResolver.reopen_after_BeginEvent' - ) + id='GitEntityResolver.reopen_after_BeginEvent') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/TestCondition Validity: 0.0 -> 9223372036.854775807 (int) parameter = {parameter} '''.format(parameter=parameter), stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/direct_mapping/test_dm_files.py b/Tools/GitEntityResolver/tests/pytest/direct_mapping/test_dm_files.py index 3b486726c2b..611e86000b6 100644 --- a/Tools/GitEntityResolver/tests/pytest/direct_mapping/test_dm_files.py +++ b/Tools/GitEntityResolver/tests/pytest/direct_mapping/test_dm_files.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -24,11 +25,14 @@ class Test(LHCbExeTest): LoadDDDBTest("2016") from GitCondDB.TestOptions import setup - setup(tag='HEAD', use_files=True, conditions=[ - '/dd/Direct/Cond1', - '/dd/Direct/Cond2', - '/dd/Direct/Nested/Cond3', - ]) + setup( + tag='HEAD', + use_files=True, + conditions=[ + '/dd/Direct/Cond1', + '/dd/Direct/Cond2', + '/dd/Direct/Nested/Cond3', + ]) reference = {"messages_count": {}} @@ -37,7 +41,8 @@ class Test(LHCbExeTest): repository = os.environ['GIT_TEST_REPOSITORY'] commit_id = None - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using checked out files in {repository} @@ -45,19 +50,20 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(repository=repository, commit_id=commit_id, tag=tag), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag} '''.format(repository=repository, commit_id=commit_id, tag=tag), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/Direct/Cond1 Validity: 123456.0 -> 9223372036.854775807 (int) parameter = 1 @@ -69,7 +75,4 @@ class Test(LHCbExeTest): (int) parameter = 0 ''', stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/direct_mapping/test_dm_head.py b/Tools/GitEntityResolver/tests/pytest/direct_mapping/test_dm_head.py index f6dff2668eb..307fb220cf2 100644 --- a/Tools/GitEntityResolver/tests/pytest/direct_mapping/test_dm_head.py +++ b/Tools/GitEntityResolver/tests/pytest/direct_mapping/test_dm_head.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -24,11 +25,13 @@ class Test(LHCbExeTest): LoadDDDBTest("2016") from GitCondDB.TestOptions import setup - setup(tag='HEAD', conditions=[ - '/dd/Direct/Cond1', - '/dd/Direct/Cond2', - '/dd/Direct/Nested/Cond3', - ]) + setup( + tag='HEAD', + conditions=[ + '/dd/Direct/Cond1', + '/dd/Direct/Cond2', + '/dd/Direct/Nested/Cond3', + ]) reference = {"messages_count": {}} @@ -36,11 +39,16 @@ class Test(LHCbExeTest): from subprocess import check_output tag = 'HEAD' repository = os.environ['GIT_TEST_REPOSITORY'] - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -48,19 +56,20 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/Direct/Cond1 Validity: 123456.0 -> 9223372036.854775807 (int) parameter = 1 @@ -72,7 +81,4 @@ class Test(LHCbExeTest): (int) parameter = 0 ''', stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/iov_access/test_iov_v0.py b/Tools/GitEntityResolver/tests/pytest/iov_access/test_iov_v0.py index e2457fc386e..ae4ee5f002e 100644 --- a/Tools/GitEntityResolver/tests/pytest/iov_access/test_iov_v0.py +++ b/Tools/GitEntityResolver/tests/pytest/iov_access/test_iov_v0.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -36,19 +37,23 @@ class Test(LHCbExeTest): ApplicationMgr(EvtMax=3) - reference = {"messages_count": {}} def test_expected_blocks(self, stdout: bytes): from subprocess import check_output tag = 'v0' repository = os.environ['GIT_TEST_REPOSITORY'] - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 0 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -56,19 +61,20 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/Changing Validity: 0.0 -> 1451602800.0 (int) parameter = 0 @@ -80,7 +86,4 @@ class Test(LHCbExeTest): (int) parameter = 0 ''', stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/iov_access/test_partitioning.py b/Tools/GitEntityResolver/tests/pytest/iov_access/test_partitioning.py index b14453aac40..09f499f7283 100644 --- a/Tools/GitEntityResolver/tests/pytest/iov_access/test_partitioning.py +++ b/Tools/GitEntityResolver/tests/pytest/iov_access/test_partitioning.py @@ -12,9 +12,10 @@ import os import re import pytest from LHCbTesting import LHCbExeTest + + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') - class Test(LHCbExeTest): command = ['gaudirun.py', '-v'] @@ -42,12 +43,17 @@ class Test(LHCbExeTest): from subprocess import check_output tag = 'v1' repository = os.environ['GIT_TEST_REPOSITORY'] - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 0 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -55,19 +61,20 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/Changing Validity: 0.0 -> 1451606400.0 (int) parameter = 0 @@ -82,7 +89,4 @@ class Test(LHCbExeTest): (int) parameter = 1 ''', stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/iov_access/test_upper_limit.py b/Tools/GitEntityResolver/tests/pytest/iov_access/test_upper_limit.py index 27f4b824342..1c9f014f260 100644 --- a/Tools/GitEntityResolver/tests/pytest/iov_access/test_upper_limit.py +++ b/Tools/GitEntityResolver/tests/pytest/iov_access/test_upper_limit.py @@ -13,6 +13,7 @@ import re import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -38,18 +39,23 @@ class Test(LHCbExeTest): ApplicationMgr(EvtMax=3) - reference = {"messages_count": {'ERROR': 3, 'FATAL':1}} + reference = {"messages_count": {'ERROR': 3, 'FATAL': 1}} def test_expected_blocks(self, stdout: bytes): from subprocess import check_output tag = 'v0' repository = os.environ['GIT_TEST_REPOSITORY'] - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 0 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -58,19 +64,20 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - stripped_output = '\n'.join(l for l in stdout.decode().splitlines() - if re.match(r'^---|^Validity|^\(int\) parameter', l)) + stripped_output = '\n'.join( + l for l in stdout.decode().splitlines() + if re.match(r'^---|^Validity|^\(int\) parameter', l)) - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' --- /dd/Changing Validity: 0.0 -> 1451602800.0 (int) parameter = 0 @@ -82,7 +89,4 @@ class Test(LHCbExeTest): (int) parameter = 0 ''', stdout=stripped_output, - id='condition_value' - ) - - + id='condition_value') diff --git a/Tools/GitEntityResolver/tests/pytest/iov_access/test_upper_limit_error.py b/Tools/GitEntityResolver/tests/pytest/iov_access/test_upper_limit_error.py index d6188b76c9a..3980bb44ce5 100644 --- a/Tools/GitEntityResolver/tests/pytest/iov_access/test_upper_limit_error.py +++ b/Tools/GitEntityResolver/tests/pytest/iov_access/test_upper_limit_error.py @@ -12,6 +12,7 @@ import os import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): @@ -39,18 +40,23 @@ class Test(LHCbExeTest): returncode = 4 - reference = {"messages_count": {'ERROR': 3, 'FATAL':1}} + reference = {"messages_count": {'ERROR': 3, 'FATAL': 1}} def test_expected_blocks(self): from subprocess import check_output tag = 'v0' repository = os.environ['GIT_TEST_REPOSITORY'] - commit_id = check_output(['git', 'rev-parse', tag], cwd=repository).decode('utf-8') + commit_id = check_output(['git', 'rev-parse', tag], + cwd=repository).decode('utf-8') parameter = 0 - info = dict(repository=repository, tag=tag, - commit_id=commit_id, short_id=commit_id[:8]) - - LHCbExeTest.find_reference_block(''' + info = dict( + repository=repository, + tag=tag, + commit_id=commit_id, + short_id=commit_id[:8]) + + LHCbExeTest.find_reference_block( + ''' ToolSvc.GitDDDB DEBUG Initializing... ToolSvc.GitDDDB INFO opening Git repository '{repository}' ToolSvc.GitDDDB INFO using commit '{tag}' corresponding to {commit_id} @@ -59,25 +65,22 @@ class Test(LHCbExeTest): ToolSvc.GitDDDB DEBUG registering to IncidentSvc ToolSvc.GitDDDB DEBUG Successfully initialized. '''.format(**info), - id='GitEntityResolver.initialization' - ) + id='GitEntityResolver.initialization') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' LoadDDDB INFO Database {repository} tag {tag}[{short_id}] '''.format(**info), - id='reported_tag' - ) + id='reported_tag') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' UpdateManagerSvc ERROR ToolSvc.GitDDDB \t Database not up-to-date. Latest known update is at 2016-12-31 23:00:00.0 UTC, event time is 2017-06-16 08:30:00.0 UTC\t StatusCode=FAILURE ''', - id='outdated_db' - ) + id='outdated_db') - LHCbExeTest.find_reference_block(''' + LHCbExeTest.find_reference_block( + ''' UpdateManagerSvc FATAL ***** The update failed. I schedule a stop of the run ***** ''', - id='update_failure' - ) - - + id='update_failure') diff --git a/Tools/GitEntityResolver/tests/pytest/test_prepare.py b/Tools/GitEntityResolver/tests/pytest/test_prepare.py index 9a05628ffcc..e638f0f3beb 100644 --- a/Tools/GitEntityResolver/tests/pytest/test_prepare.py +++ b/Tools/GitEntityResolver/tests/pytest/test_prepare.py @@ -11,6 +11,7 @@ import pytest from LHCbTesting import LHCbExeTest + @pytest.mark.ctest_fixture_setup('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') class Test(LHCbExeTest): diff --git a/Tools/GitEntityResolver/tests/pytest/test_run_stamp.py b/Tools/GitEntityResolver/tests/pytest/test_run_stamp.py index 339ff587d8e..308b003c8f0 100644 --- a/Tools/GitEntityResolver/tests/pytest/test_run_stamp.py +++ b/Tools/GitEntityResolver/tests/pytest/test_run_stamp.py @@ -11,9 +11,10 @@ import re import pytest from LHCbTesting import LHCbExeTest + + @pytest.mark.ctest_fixture_required('gitentityresolver.prepare') @pytest.mark.shared_cwd('GitEntityResolver') - class Test(LHCbExeTest): command = ['gaudirun.py', '-v'] @@ -29,32 +30,34 @@ class Test(LHCbExeTest): epoch = datetime(1970, 1, 1) return int((datetime(*args) - epoch).total_seconds() * 1000000000) - ecs = EventClockSvc(InitialTime = ts(2015, 6, 10, 12, 00)) + ecs = EventClockSvc(InitialTime=ts(2015, 6, 10, 12, 00)) ecs.addTool(FakeEventTime, "EventTimeDecoder") ecs.EventTimeDecoder.StartTime = ts(2015, 6, 9, 12, 00) - ecs.EventTimeDecoder.TimeStep = 24 * 60 * 60 * 1000000000 # 1 day + ecs.EventTimeDecoder.TimeStep = 24 * 60 * 60 * 1000000000 # 1 day ecs.EventTimeDecoder.StartRun = 100 ecs.EventTimeDecoder.EventsPerRun = 1 DDDBConf(EnableRunStampCheck=True) - RunStampCheck(OutputLevel=DEBUG, - ValidRunsList='git://valid_runs.txt') + RunStampCheck(OutputLevel=DEBUG, ValidRunsList='git://valid_runs.txt') + + algMgr = ApplicationMgr(EvtSel="NONE", EvtMax=4) - algMgr = ApplicationMgr(EvtSel = "NONE", EvtMax = 4) #MessageSvc(OutputLevel = 1) def tweakVFS(): from Gaudi.Configuration import VFSSvc vfs = VFSSvc() - vfs.FileAccessTools = [vfs.FileAccessTools[0], - allConfigurables['ToolSvc.GitDDDB']] + vfs.FileAccessTools = [ + vfs.FileAccessTools[0], allConfigurables['ToolSvc.GitDDDB'] + ] + appendPostConfigAction(tweakVFS) returncode = 4 def test_expected_blocks(self, stdout: bytes): - outputlines = [ l.rstrip() for l in stdout.decode().splitlines() ] + outputlines = [l.rstrip() for l in stdout.decode().splitlines()] ## Check that we find the expected lines in the right order expected = ''' @@ -72,6 +75,4 @@ class Test(LHCbExeTest): if exp.match(l): seen.append(l) - assert seen == expected, ( - 'Order of RunStampCheck lines not correct.' - ) \ No newline at end of file + assert seen == expected, ('Order of RunStampCheck lines not correct.') diff --git a/Tools/ZeroMQ/tests/pytest/test_serialize_binary.py b/Tools/ZeroMQ/tests/pytest/test_serialize_binary.py index 983536dc3a0..ff42fb5b98a 100644 --- a/Tools/ZeroMQ/tests/pytest/test_serialize_binary.py +++ b/Tools/ZeroMQ/tests/pytest/test_serialize_binary.py @@ -10,6 +10,7 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '../options/TestSerializeBinary.py'] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 2}} diff --git a/Tools/ZeroMQ/tests/pytest/test_serialize_text.py b/Tools/ZeroMQ/tests/pytest/test_serialize_text.py index c3ffb63111e..afee450d2fb 100644 --- a/Tools/ZeroMQ/tests/pytest/test_serialize_text.py +++ b/Tools/ZeroMQ/tests/pytest/test_serialize_text.py @@ -10,9 +10,9 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '../options/TestSerializeText.py'] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 2}} # Author: Roel Aaij # Purpose: Check serialization works - diff --git a/UT/UTDAQ/tests/pytest/test_ut_decoding.py b/UT/UTDAQ/tests/pytest/test_ut_decoding.py index f9a3fbcb0e4..f27dc3d1a28 100644 --- a/UT/UTDAQ/tests/pytest/test_ut_decoding.py +++ b/UT/UTDAQ/tests/pytest/test_ut_decoding.py @@ -10,6 +10,7 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): command = ['gaudirun.py', '$UTDAQROOT/tests/options/ut_test_sim.py'] - reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} \ No newline at end of file + reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} diff --git a/VP/VPDAQ/tests/pytest/test_retina_decoding.py b/VP/VPDAQ/tests/pytest/test_retina_decoding.py index bbd47ad0a8d..5a9453d688a 100644 --- a/VP/VPDAQ/tests/pytest/test_retina_decoding.py +++ b/VP/VPDAQ/tests/pytest/test_retina_decoding.py @@ -10,6 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '$VPDAQROOT/tests/options/digi_retinacluster.py', '$VPDAQROOT/tests/options/retina_decoding.py'] + command = [ + 'gaudirun.py', '$VPDAQROOT/tests/options/digi_retinacluster.py', + '$VPDAQROOT/tests/options/retina_decoding.py' + ] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} diff --git a/VP/VPDAQ/tests/pytest/test_retina_full_decoding.py b/VP/VPDAQ/tests/pytest/test_retina_full_decoding.py index 5d7f91fb6a7..16dc884698f 100644 --- a/VP/VPDAQ/tests/pytest/test_retina_full_decoding.py +++ b/VP/VPDAQ/tests/pytest/test_retina_full_decoding.py @@ -10,7 +10,10 @@ ############################################################################### from LHCbTesting import LHCbExeTest + class Test(LHCbExeTest): - command = ['gaudirun.py', '$VPDAQROOT/tests/options/digi_retinacluster.py', '$VPDAQROOT/tests/options/retina_full_decoding.py'] + command = [ + 'gaudirun.py', '$VPDAQROOT/tests/options/digi_retinacluster.py', + '$VPDAQROOT/tests/options/retina_full_decoding.py' + ] reference = {"messages_count": {"FATAL": 0, "ERROR": 0, "WARNING": 0}} - diff --git a/utils/qmt2pytest b/utils/qmt2pytest index b081ef7f1c4..ff3be87b4ee 100755 --- a/utils/qmt2pytest +++ b/utils/qmt2pytest @@ -27,8 +27,7 @@ from GaudiTesting.utils import ( str_representer, ) from LHCbTesting.utils import ( - find_counters_summaries, -) + find_counters_summaries, ) yaml.representer.SafeRepresenter.add_representer(str, str_representer) @@ -53,7 +52,6 @@ class Test(LHCbExeTest): {attributes} """ - TEMPLATE_VALIDATOR_TEST = """ def test_stdout(self, stdout: bytes): # FIXME implement validation of stdout @@ -92,9 +90,8 @@ def parse_arguments(qmt_file, qmt_dir, pytest_dir): program = resolve_path(program) elif name == "args": args = [ - resolve_path(el.text) - if os.path.isfile(os.path.join(qmt_dir, el.text)) - else el.text + resolve_path(el.text) if os.path.isfile( + os.path.join(qmt_dir, el.text)) else el.text for el in value.findall("text") ] elif name == "reference": @@ -143,11 +140,12 @@ def resolve_wildcard_imports(code): explicit_imports = getattr(sys.modules[module], "__all__", []) else: explicit_imports = [ - name for name in dir(import_module(module)) if not name.startswith("_") + name for name in dir(import_module(module)) + if not name.startswith("_") ] code = code.replace( - match.group(0), f'from {module} import {", ".join(explicit_imports)}' - ) + match.group(0), + f'from {module} import {", ".join(explicit_imports)}') return code @@ -156,7 +154,7 @@ def find_qmt_dir(qmt_file): parts = qmt_file.split(os.sep) for i, part in enumerate(parts): if part == "qmtest": - return os.sep.join(parts[: i + 1]) + return os.sep.join(parts[:i + 1]) return "" @@ -170,16 +168,15 @@ def convert_qmt_to_pytest(qmt_file): pytest_dir = os.path.dirname(output_file) platforms, attrs, validator_code, prerequisites = parse_arguments( - qmt_file, qmt_dir, pytest_dir - ) + qmt_file, qmt_dir, pytest_dir) - fixture_name = fix_prerequisite_prefix(deduce_fixture_name(qmt_file), qmt_file) + fixture_name = fix_prerequisite_prefix( + deduce_fixture_name(qmt_file), qmt_file) pytest_code = TEMPLATE_HEADER pytest_code += "".join( f"@pytest.mark.ctest_fixture_required({fix_prerequisite_prefix(name, qmt_file)!r})\n" - for name in prerequisites - ) + for name in prerequisites) if fixture_name in _fixtures_required: pytest_code += f"@pytest.mark.ctest_fixture_setup({fixture_name!r})\n" @@ -188,11 +185,10 @@ def convert_qmt_to_pytest(qmt_file): pytest_code += f"@pytest.mark.shared_cwd({subdir_name!r})\n" if platforms: pytest_code += f'@pytest.mark.skipif(platform_matches({platforms}), reason="Unsupported platform")\n' - pytest_code += TEMPLATE_CLASS.format( - attributes=attrs, - ) + pytest_code += TEMPLATE_CLASS.format(attributes=attrs, ) if validator_code: - pytest_code += TEMPLATE_VALIDATOR_TEST.format(validator_code=validator_code) + pytest_code += TEMPLATE_VALIDATOR_TEST.format( + validator_code=validator_code) os.makedirs(os.path.dirname(output_file), exist_ok=True) with open(output_file, "w") as f: @@ -208,6 +204,7 @@ def convert_qmt_to_pytest(qmt_file): _converted_files.add(qmt_file) click.echo(f"converted {qmt_file} to {output_file}") + def generate_output_filename(qmt_file): parent, dir_name = os.path.split(os.path.abspath(qmt_file)) while dir_name and dir_name != "tests": @@ -215,9 +212,9 @@ def generate_output_filename(qmt_file): optional_qms = f"{os.path.basename(parent).lower()}.qms/" if dir_name else None base_name = os.path.basename(qmt_file).replace(".qmt", ".py") - new_name = os.path.join(os.path.dirname(qmt_file), f"test_{base_name}").replace( - "/qmtest/", "/pytest/" - ) + new_name = os.path.join(os.path.dirname(qmt_file), + f"test_{base_name}").replace( + "/qmtest/", "/pytest/") if optional_qms: new_name = new_name.replace(optional_qms, "") new_name = new_name.replace(".qms", "") @@ -226,7 +223,7 @@ def generate_output_filename(qmt_file): def _get_ref_variants(model: Path) -> dict[tuple, Path]: return { - tuple(sorted(set(re.split(r"[-+]", p.name[len(model.name) + 1 :])))): p + tuple(sorted(set(re.split(r"[-+]", p.name[len(model.name) + 1:])))): p for p in model.parent.glob(f"{model.name}.*") if not p.name.endswith("new") } @@ -235,11 +232,9 @@ def _get_ref_variants(model: Path) -> dict[tuple, Path]: def convert_references(stdout=None, stderr=None): global _converted_files assert stdout or stderr - name_prefix = ( - (stdout if stdout else stderr.replace("_err.", ".")) - .replace("/qmtest/", "/pytest/") - .replace(".ref", "") - ) + name_prefix = ((stdout + if stdout else stderr.replace("_err.", ".")).replace( + "/qmtest/", "/pytest/").replace(".ref", "")) stdout_variants = {} stderr_variants = {} if stdout: @@ -254,9 +249,12 @@ def convert_references(stdout=None, stderr=None): with open(stdout) as f: default_reference["stdout"] = f.read() _converted_files.add(stdout) - default_reference["histos"] = find_histos_summaries(default_reference["stdout"]) - default_reference["ttrees"] = find_ttree_summaries(default_reference["stdout"]) - default_reference["counters"] = find_counters_summaries(default_reference["stdout"]) + default_reference["histos"] = find_histos_summaries( + default_reference["stdout"]) + default_reference["ttrees"] = find_ttree_summaries( + default_reference["stdout"]) + default_reference["counters"] = find_counters_summaries( + default_reference["stdout"]) if stderr: with open(stderr) as f: default_reference["stderr"] = f.read() @@ -264,7 +262,8 @@ def convert_references(stdout=None, stderr=None): os.makedirs(os.path.dirname(name_prefix), exist_ok=True) with open(f"{name_prefix}.yaml", "w") as out: - yaml.safe_dump(default_reference, out, sort_keys=False, default_flow_style = False) + yaml.safe_dump( + default_reference, out, sort_keys=False, default_flow_style=False) run(["git", "add", f"{name_prefix}.yaml"]) for variant in set(stdout_variants).union(stderr_variants): @@ -276,13 +275,15 @@ def convert_references(stdout=None, stderr=None): _converted_files.add(stdout_variants[variant]) reference["histos"] = find_histos_summaries(reference["stdout"]) reference["ttrees"] = find_ttree_summaries(reference["stdout"]) - reference["counters"] = find_counters_summaries(default_reference["stdout"]) + reference["counters"] = find_counters_summaries( + default_reference["stdout"]) if variant in stderr_variants: with open(stderr_variants[variant]) as f: reference["stderr"] = f.read() _converted_files.add(stderr_variants[variant]) with open(name, "w") as out: - yaml.safe_dump(reference, out, sort_keys=False, default_flow_style = False) + yaml.safe_dump( + reference, out, sort_keys=False, default_flow_style=False) run(["git", "add", name]) return f"{name_prefix}.yaml" @@ -307,8 +308,9 @@ def fix_prerequisite_prefix(name, qmt): @click.command() @click.argument("names", nargs=-1) @click.option( - "--remove/--no-remove", default=False, help="delete the files that are converted" -) + "--remove/--no-remove", + default=False, + help="delete the files that are converted") def main(names, remove): global _converted_files global _fixtures_required @@ -324,10 +326,8 @@ def main(names, remove): for name in names: _fixtures_required.update( fix_prerequisite_prefix(el.text.lower(), name) - for el in ET.parse(name) - .getroot() - .findall('argument[@name="prerequisites"]/set/tuple/text') - ) + for el in ET.parse(name).getroot().findall( + 'argument[@name="prerequisites"]/set/tuple/text')) fixtures_setup = {deduce_fixture_name(name): name for name in names} if not _fixtures_required.issubset(fixtures_setup): exit( @@ -342,7 +342,8 @@ def main(names, remove): pytest_dir = Path(find_qmt_dir(name)).parent / "pytest" if pytest_dir not in existing_modules: existing_modules[pytest_dir] = { - mod.name: mod for mod in pytest_dir.glob("**/test_*.py") + mod.name: mod + for mod in pytest_dir.glob("**/test_*.py") } output = Path(generate_output_filename(name)) if output.name in existing_modules[pytest_dir]: -- GitLab