diff --git a/Phys/DaVinciKernel/CMakeLists.txt b/Phys/DaVinciKernel/CMakeLists.txt index 7de8355f3769515b697bccfb75db369eebfa0703..9ecb9a3a057ccb478e36c6a79076a237c17dc380 100644 --- a/Phys/DaVinciKernel/CMakeLists.txt +++ b/Phys/DaVinciKernel/CMakeLists.txt @@ -79,6 +79,4 @@ if(BUILD_TESTING) endforeach() endif() -gaudi_add_tests(pytest ${CMAKE_CURRENT_SOURCE_DIR}/tests/decays/test_descriptor_parsing.py) -gaudi_add_tests(pytest ${CMAKE_CURRENT_SOURCE_DIR}/tests/decays/test_decayfinder.py) -gaudi_add_tests(pytest ${CMAKE_CURRENT_SOURCE_DIR}/tests/decays/test_simple_descriptors.py) +gaudi_add_pytest(tests/decays) diff --git a/Phys/DaVinciKernel/tests/decays/__init__.py b/Phys/DaVinciKernel/tests/decays/__init__.py deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/Phys/DaVinciKernel/tests/decays/test_decayfinder.py b/Phys/DaVinciKernel/tests/decays/test_decayfinder.py index 055a28a5a3193da88d30d67ba8756b86a70852f7..b7423b328da10562239d2396e174cce784a77d10 100644 --- a/Phys/DaVinciKernel/tests/decays/test_decayfinder.py +++ b/Phys/DaVinciKernel/tests/decays/test_decayfinder.py @@ -10,29 +10,45 @@ ############################################################################### import GaudiPython -import PartProp.Service # this is required for app.ppSvc() to work import pytest from Configurables import DDDBConf from cppyy.gbl import LHCb, SmartRef, SmartRefVector, std from GaudiPython.Bindings import AppMgr -DDDBConf() -appMgr = AppMgr() -pps = appMgr.ppSvc() -# below is required for ppSvc to work for pytest -appMgr.ExtSvc += ["LHCb::ParticlePropertySvc"] -toolsvc = appMgr.toolSvc() -appMgr.initialize() + +@pytest.fixture(scope="module") +def appmgr(): + # this is required for app.ppSvc() to work + import PartProp.Service # noqa: F401 + + DDDBConf() + appMgr = AppMgr() + appMgr.ppSvc() + # below is required for ppSvc to work for pytest + appMgr.ExtSvc += ["LHCb::ParticlePropertySvc"] + appMgr.toolSvc() + appMgr.initialize() + yield appMgr + + +@pytest.fixture +def toolsvc(appmgr): + yield appmgr.toolSvc() + + +@pytest.fixture +def pps(appmgr): + yield appmgr.ppSvc() # helper class for testing the decay finder -class PseudoParticle: +class PseudoParticleMaker: """ PseudoParticle helper class for testing. It builds tree of particles Needs to be after AppMgr definition since we use particle property service from AppMgr """ - def __init__(self, name, daug=None): + def __init__(self, pps, name, daug=None): """ name: name of the particle daug: list of Particle objects of daughters @@ -62,12 +78,12 @@ class PseudoParticle: @pytest.fixture() -def tool_DecayFinder_Particles(): - decoder = toolsvc.create("DecayFinder", interface=GaudiPython.gbl.IDecayFinder) - return decoder +def decoder(toolsvc): + return toolsvc.create("DecayFinder", interface=GaudiPython.gbl.IDecayFinder) -def make_input_particles(): +def make_input_particles(pps): + PseudoParticle = lambda name, *args: PseudoParticleMaker(pps, name, *args) # Build: "B0 -> K+ K-" Bd_daug = [PseudoParticle("K+"), PseudoParticle("K-")] Bd = PseudoParticle("B0", Bd_daug) @@ -194,26 +210,22 @@ def get_marked_particles(descriptor, input_parts, decoder): return out_parts -def test_decayfinder_twobody(tool_DecayFinder_Particles): +def test_decayfinder_twobody(decoder, pps): # simple two-body descriptor test descriptor = "[B0 -> [K+]CC ^pi-]CC" - input_parts = make_input_particles() - output_parts = get_marked_particles( - descriptor, input_parts, tool_DecayFinder_Particles - ) + input_parts = make_input_particles(pps) + output_parts = get_marked_particles(descriptor, input_parts, decoder) assert output_parts.size() == 1 assert output_parts[0].particleID().pid() == -211 # simple two-body descriptor test (with charge conjugate particle names) # the ouput_parts and output_parts_cc (below) should be identical descriptor_cc = "[B~0 -> [K-]CC ^pi+]CC" - output_parts_cc = get_marked_particles( - descriptor_cc, input_parts, tool_DecayFinder_Particles - ) + output_parts_cc = get_marked_particles(descriptor_cc, input_parts, decoder) assert output_parts_cc.size() == output_parts.size() assert output_parts_cc[0].particleID().pid() == output_parts[0].particleID().pid() -def test_decayfinder_identical_threebody(tool_DecayFinder_Particles): +def test_decayfinder_identical_threebody(decoder, pps): def _assert(outparts_1, outparts_2, outparts_1_cc, outparts_2_cc): # size should be the same assert outparts_1.size() == 3 @@ -248,79 +260,51 @@ def test_decayfinder_identical_threebody(tool_DecayFinder_Particles): # descriptor matches order 1 of input container descriptor_1 = "[B+ -> K+ K- ^K+]CC" # pick always 2nd kaon in the input_container (no matter the ordering) descriptor_2 = "[B+ -> ^K+ K- K+]CC" # pick always 1st kaon in the input_container (no matter the ordering) - input_parts = make_input_particles() - output_parts_1 = get_marked_particles( - descriptor_1, input_parts, tool_DecayFinder_Particles - ) - output_parts_2 = get_marked_particles( - descriptor_2, input_parts, tool_DecayFinder_Particles - ) + input_parts = make_input_particles(pps) + output_parts_1 = get_marked_particles(descriptor_1, input_parts, decoder) + output_parts_2 = get_marked_particles(descriptor_2, input_parts, decoder) # check if CC'd particle names also picks correct particles descriptor_1_cc = "[B- -> K- K+ ^K-]CC" descriptor_2_cc = "[B- -> ^K- K+ K-]CC" - output_parts_1_cc = get_marked_particles( - descriptor_1_cc, input_parts, tool_DecayFinder_Particles - ) - output_parts_2_cc = get_marked_particles( - descriptor_2_cc, input_parts, tool_DecayFinder_Particles - ) + output_parts_1_cc = get_marked_particles(descriptor_1_cc, input_parts, decoder) + output_parts_2_cc = get_marked_particles(descriptor_2_cc, input_parts, decoder) # conduct some checks _assert(output_parts_1, output_parts_2, output_parts_1_cc, output_parts_2_cc) # descriptor matches order 2 of input container descriptor_1 = "[B+ -> K- K+ ^K+]CC" # pick always 2nd kaon in the input_container (no matter the ordering) descriptor_2 = "[B+ -> K- ^K+ K+]CC" # pick always 1st kaon in the input_container (no matter the ordering) - output_parts_1 = get_marked_particles( - descriptor_1, input_parts, tool_DecayFinder_Particles - ) - output_parts_2 = get_marked_particles( - descriptor_2, input_parts, tool_DecayFinder_Particles - ) + output_parts_1 = get_marked_particles(descriptor_1, input_parts, decoder) + output_parts_2 = get_marked_particles(descriptor_2, input_parts, decoder) # check if CC'd particle names also picks correct particles descriptor_1_cc = "[B- -> K+ K- ^K-]CC" descriptor_2_cc = "[B- -> K+ ^K- K-]CC" - output_parts_1_cc = get_marked_particles( - descriptor_1_cc, input_parts, tool_DecayFinder_Particles - ) - output_parts_2_cc = get_marked_particles( - descriptor_2_cc, input_parts, tool_DecayFinder_Particles - ) + output_parts_1_cc = get_marked_particles(descriptor_1_cc, input_parts, decoder) + output_parts_2_cc = get_marked_particles(descriptor_2_cc, input_parts, decoder) # conduct some checks _assert(output_parts_1, output_parts_2, output_parts_1_cc, output_parts_2_cc) # descriptor matches order 3 of input container descriptor_1 = "[B+ -> K+ ^K+ K-]CC" # pick always 2nd kaon in the input_container (no matter the ordering) descriptor_2 = "[B+ -> ^K+ K+ K-]CC" # pick always 1st kaon in the input_container (no matter the ordering) - output_parts_1 = get_marked_particles( - descriptor_1, input_parts, tool_DecayFinder_Particles - ) - output_parts_2 = get_marked_particles( - descriptor_2, input_parts, tool_DecayFinder_Particles - ) + output_parts_1 = get_marked_particles(descriptor_1, input_parts, decoder) + output_parts_2 = get_marked_particles(descriptor_2, input_parts, decoder) # check if CC'd particle names also picks correct particles descriptor_1_cc = "[B- -> K- ^K- K+]CC" descriptor_2_cc = "[B- -> ^K- K- K+]CC" - output_parts_1_cc = get_marked_particles( - descriptor_1_cc, input_parts, tool_DecayFinder_Particles - ) - output_parts_2_cc = get_marked_particles( - descriptor_2_cc, input_parts, tool_DecayFinder_Particles - ) + output_parts_1_cc = get_marked_particles(descriptor_1_cc, input_parts, decoder) + output_parts_2_cc = get_marked_particles(descriptor_2_cc, input_parts, decoder) # conduct some checks _assert(output_parts_1, output_parts_2, output_parts_1_cc, output_parts_2_cc) -def test_decayfinder_identical_fourbody(tool_DecayFinder_Particles): +def test_decayfinder_identical_fourbody(decoder, pps): # test finding of identical particles present in four-body decay descriptor_1 = "[D~0 -> ^pi- pi+ pi- pi+]CC" descriptor_2 = "[D~0 -> pi- pi+ ^pi- pi+]CC" - input_parts = make_input_particles() - output_parts_1 = get_marked_particles( - descriptor_1, input_parts, tool_DecayFinder_Particles - ) - output_parts_2 = get_marked_particles( - descriptor_2, input_parts, tool_DecayFinder_Particles - ) + input_parts = make_input_particles(pps) + output_parts_1 = get_marked_particles(descriptor_1, input_parts, decoder) + output_parts_2 = get_marked_particles(descriptor_2, input_parts, decoder) # size should be the same assert output_parts_1.size() == 1 assert output_parts_1.size() == output_parts_2.size() @@ -332,17 +316,13 @@ def test_decayfinder_identical_fourbody(tool_DecayFinder_Particles): assert abs(output_parts_2[0].momentum().X() - 6.0) < 1e-9 -def test_decayfinder_identical_headdecay_and_daugterdecay(tool_DecayFinder_Particles): +def test_decayfinder_identical_headdecay_and_daugterdecay(decoder, pps): # test finding of identical particles present at two levels: head decay and daughter decay descriptor_1 = "[B+ -> phi(1020) (phi(1020) -> gamma ^pi0 pi0) K+]CC" descriptor_2 = "[B+ -> phi(1020) (phi(1020) -> pi0 gamma ^pi0) K+]CC" - input_parts = make_input_particles() - output_parts_1 = get_marked_particles( - descriptor_1, input_parts, tool_DecayFinder_Particles - ) - output_parts_2 = get_marked_particles( - descriptor_2, input_parts, tool_DecayFinder_Particles - ) + input_parts = make_input_particles(pps) + output_parts_1 = get_marked_particles(descriptor_1, input_parts, decoder) + output_parts_2 = get_marked_particles(descriptor_2, input_parts, decoder) # size should be the same assert output_parts_1.size() == 1 assert output_parts_1.size() == output_parts_2.size() @@ -354,53 +334,43 @@ def test_decayfinder_identical_headdecay_and_daugterdecay(tool_DecayFinder_Parti assert abs(output_parts_2[0].momentum().X() - 4.0) < 1e-9 -def test_decayfinder_depth_1(tool_DecayFinder_Particles): +def test_decayfinder_depth_1(decoder, pps): # descriptor that finds particles in the head node decay (depth 1) descriptor = "[B_s0 -> K*(892)0 ^K*_0(1430)~0]CC" - input_parts = make_input_particles() - output_parts = get_marked_particles( - descriptor, input_parts, tool_DecayFinder_Particles - ) + input_parts = make_input_particles(pps) + output_parts = get_marked_particles(descriptor, input_parts, decoder) assert output_parts.size() == 2 assert output_parts[0].particleID().pid() == -10311 assert output_parts[1].particleID().pid() == -10311 # descriptor that matches top level particles but particles names are CC'd # the ouput_parts and output_parts_cc (below) should be identical descriptor_cc = "[B_s~0 -> K*(892)~0 ^K*_0(1430)0]CC" - output_parts_cc = get_marked_particles( - descriptor_cc, input_parts, tool_DecayFinder_Particles - ) + output_parts_cc = get_marked_particles(descriptor_cc, input_parts, decoder) assert output_parts_cc.size() == output_parts.size() assert output_parts_cc[0].particleID().pid() == output_parts[0].particleID().pid() assert output_parts_cc[1].particleID().pid() == output_parts[1].particleID().pid() -def test_decayfinder_depth_2(tool_DecayFinder_Particles): +def test_decayfinder_depth_2(decoder, pps): # descriptor that finds particles in the immediate daughter decay (depth 2) descriptor = "[B_s0 -> K*(892)0 (K*_0(1430)~0 -> ^K*(892)0 pi+ pi-)]CC" - input_parts = make_input_particles() - output_parts = get_marked_particles( - descriptor, input_parts, tool_DecayFinder_Particles - ) + input_parts = make_input_particles(pps) + output_parts = get_marked_particles(descriptor, input_parts, decoder) assert output_parts.size() == 1 assert output_parts[0].particleID().pid() == 313 # descriptor with depth 2 but selects with CC particle names # output_parts and output_parts_2_cc should be identical descriptor_cc = "[B_s~0 -> K*(892)~0 (K*_0(1430)0 -> ^K*(892)~0 pi- pi+)]CC" - output_parts_cc = get_marked_particles( - descriptor_cc, input_parts, tool_DecayFinder_Particles - ) + output_parts_cc = get_marked_particles(descriptor_cc, input_parts, decoder) assert output_parts_cc.size() == output_parts.size() assert output_parts_cc[0].particleID().pid() == output_parts[0].particleID().pid() -def test_decayfinder_depth_3(tool_DecayFinder_Particles): +def test_decayfinder_depth_3(decoder, pps): # descriptor that finds particles in the daughte of daughter decay (depth 3) descriptor = "[B_s0 -> K*(892)0 (K*_0(1430)~0 -> (K*(892)0 -> ^K+ pi-) pi+ pi-)]CC" - input_parts = make_input_particles() - output_parts = get_marked_particles( - descriptor, input_parts, tool_DecayFinder_Particles - ) + input_parts = make_input_particles(pps) + output_parts = get_marked_particles(descriptor, input_parts, decoder) assert output_parts.size() == 1 assert output_parts[0].particleID().pid() == 321 # descriptor with depth 2 but selects with CC particle names @@ -408,25 +378,19 @@ def test_decayfinder_depth_3(tool_DecayFinder_Particles): descriptor_cc = ( "[B_s~0 -> K*(892)~0 (K*_0(1430)0 -> (K*(892)~0 -> ^K- pi+) pi- pi+)]CC" ) - output_parts_cc = get_marked_particles( - descriptor_cc, input_parts, tool_DecayFinder_Particles - ) + output_parts_cc = get_marked_particles(descriptor_cc, input_parts, decoder) assert output_parts_cc.size() == output_parts.size() assert output_parts_cc[0].particleID().pid() == output_parts[0].particleID().pid() -def test_intermediate_identical(tool_DecayFinder_Particles): +def test_intermediate_identical(decoder, pps): # test finding of identical particles present at two levels: head decay and daughter decay - input_parts = make_input_particles() + input_parts = make_input_particles(pps) descriptor_1 = "psi(3770) -> (D0 -> K- pi+) (D0 -> pi- ^pi+)" - output_parts_1 = get_marked_particles( - descriptor_1, input_parts, tool_DecayFinder_Particles - ) + output_parts_1 = get_marked_particles(descriptor_1, input_parts, decoder) # correct descriptor descriptor_2 = "psi(3770) -> (D0 -> ^K+ K-) (D0 -> pi- pi+)" - output_parts_2 = get_marked_particles( - descriptor_2, input_parts, tool_DecayFinder_Particles - ) + output_parts_2 = get_marked_particles(descriptor_2, input_parts, decoder) # there should not be any match assert output_parts_1.size() == 0 # size should be the 1 diff --git a/Phys/DaVinciKernel/tests/decays/test_descriptor_parsing.py b/Phys/DaVinciKernel/tests/decays/test_descriptor_parsing.py index 2d0d00a95121a6617a59b6773bc2e8ae1ee041f9..61506437e79812c07196aedc19505c447a2ebcaa 100644 --- a/Phys/DaVinciKernel/tests/decays/test_descriptor_parsing.py +++ b/Phys/DaVinciKernel/tests/decays/test_descriptor_parsing.py @@ -10,34 +10,34 @@ ############################################################################### import GaudiPython -import PartProp.Service # this is required for app.ppSvc() to work import pytest from Configurables import DDDBConf from cppyy.gbl import LHCb, SmartRef, SmartRefVector, std from DDDB.CheckDD4Hep import UseDD4Hep from GaudiPython.Bindings import AppMgr -DDDBConf(Simulation=False, GeometryVersion="upgrade/master", DataType="Upgrade") -if not UseDD4Hep: - from Configurables import CondDB - CondDB(Upgrade=True).Tags["DDDB"] = "upgrade/master" -appMgr = AppMgr() -pps = appMgr.ppSvc() -# below is required for ppSvc to work for pytest -appMgr.ExtSvc += ["LHCb::ParticlePropertySvc"] -toolsvc = appMgr.toolSvc() -appMgr.initialize() +@pytest.fixture(scope="module") +def toolsvc(): + DDDBConf(Simulation=False, GeometryVersion="upgrade/master", DataType="Upgrade") + if not UseDD4Hep: + from Configurables import CondDB + CondDB(Upgrade=True).Tags["DDDB"] = "upgrade/master" + appMgr = AppMgr() + # below is required for ppSvc to work for pytest + appMgr.ExtSvc += ["LHCb::ParticlePropertySvc"] + toolsvc = appMgr.toolSvc() + appMgr.initialize() + return toolsvc -@pytest.fixture() -def tool_DecayFinder_Particles(): - decoder = toolsvc.create("DecayFinder", interface=GaudiPython.gbl.IDecayFinder) - return decoder +@pytest.fixture +def decoder(toolsvc): + return toolsvc.create("DecayFinder", interface=GaudiPython.gbl.IDecayFinder) -def test_parsing_exceptions(tool_DecayFinder_Particles): - decoder = tool_DecayFinder_Particles + +def test_parsing_exceptions(decoder): # map of wrong (key) -> allowed (value) descriptors map_wrong_to_correct_descriptors = { # exception raised for wrong particle name @@ -81,8 +81,7 @@ def test_parsing_exceptions(tool_DecayFinder_Particles): assert False, f"{desc} raised an exception {exc}" -def test_parsing_node(tool_DecayFinder_Particles): - decoder = tool_DecayFinder_Particles +def test_parsing_node(decoder): descriptors = ["^B_s0"] # hat descriptors += ["[B_s0]CC"] # CC descriptors += ["^[B_s0]CC"] # hat and CC @@ -93,8 +92,7 @@ def test_parsing_node(tool_DecayFinder_Particles): assert parsed_descriptor == descriptor.replace(" ", "") -def test_parsing_CC(tool_DecayFinder_Particles): - decoder = tool_DecayFinder_Particles +def test_parsing_CC(decoder): descriptors = ["B_s0 -> mu+ mu-"] # simple descriptor descriptors += ["B_s0 -> mu+ [mu-]CC"] @@ -114,8 +112,7 @@ def test_parsing_CC(tool_DecayFinder_Particles): assert parsed_descriptor == descriptor -def test_parsing_hat(tool_DecayFinder_Particles): - decoder = tool_DecayFinder_Particles +def test_parsing_hat(decoder): descriptors = ["B_s0 -> mu+ mu-"] # No hat implies head node hat implicitly descriptors += ["^B_s0 -> mu+ mu-"] # hat on head node descriptors += ["^(B_s0 -> mu+ mu-)"] # hat in the decay @@ -130,8 +127,7 @@ def test_parsing_hat(tool_DecayFinder_Particles): assert parsed_descriptor == descriptor -def test_parsing_CC_and_hat(tool_DecayFinder_Particles): - decoder = tool_DecayFinder_Particles +def test_parsing_CC_and_hat(decoder): descriptors = ["^[B_s0]CC -> mu+ mu-"] # hat on CC'd head node descriptors += ["^([B_s0 -> mu+ mu-]CC)"] # hat in the CC'd decay descriptors += [ @@ -159,8 +155,7 @@ def test_parsing_CC_and_hat(tool_DecayFinder_Particles): assert parsed_descriptor == descriptor -def test_parsing_whitespaces(tool_DecayFinder_Particles): - decoder = tool_DecayFinder_Particles +def test_parsing_whitespaces(decoder): # map of user_descriptor (key) -> parsed_descriptor (value) map_user_parsed = {} map_user_parsed[" ^ [ K*_0(1430)~0 ] CC"] = ( @@ -209,8 +204,7 @@ def test_parsing_whitespaces(tool_DecayFinder_Particles): assert expected_parsed_descriptor == parsed_descriptor -def test_parsing_complex_decays(tool_DecayFinder_Particles): - decoder = tool_DecayFinder_Particles +def test_parsing_complex_decays(decoder): # WARNING: Fake decays descriptors = [] descriptors += [ @@ -230,9 +224,7 @@ def test_parsing_complex_decays(tool_DecayFinder_Particles): assert parsed_descriptor == descriptor -def test_decay_possibilities(tool_DecayFinder_Particles): - decoder = tool_DecayFinder_Particles - +def test_decay_possibilities(decoder): # Simple case descriptor = "[B_s0 -> [K*_0(1430)~0]CC K*(892)0]CC" number_of_CC = 2 @@ -286,10 +278,9 @@ def test_decay_possibilities(tool_DecayFinder_Particles): assert expected_possibility == possibility -def test_parsing_arrows(tool_DecayFinder_Particles): +def test_parsing_arrows(decoder): # parsing of arrow notation # NOTE: the finding of particles according to arrow is not implemented yet - decoder = tool_DecayFinder_Particles descriptors = [] descriptors += ["B_s0 -> (K*_0(1430)~0 -> K*(892)0 pi+ pi-) K*(892)0"] # -> descriptors += ["B_s0 -> (K*_0(1430)~0 --> K*(892)0 pi+ pi-) K*(892)0"] # --> diff --git a/Phys/DaVinciKernel/tests/decays/test_simple_descriptors.py b/Phys/DaVinciKernel/tests/decays/test_simple_descriptors.py index c83274ba78c45cc4f5680b20f878cfce93c60455..affb877ddcf1d6419ddc1e54d0f03540936504d6 100644 --- a/Phys/DaVinciKernel/tests/decays/test_simple_descriptors.py +++ b/Phys/DaVinciKernel/tests/decays/test_simple_descriptors.py @@ -10,33 +10,31 @@ ############################################################################### import GaudiPython -import PartProp.Service import pytest from Configurables import DDDBConf, MessageSvc from GaudiPython.Bindings import AppMgr -MessageSvc(OutputLevel=1) +Decay = GaudiPython.gbl.Decays.Decay -DDDBConf() -app = AppMgr() -pps = app.ppSvc() -toolsvc = app.toolSvc() -app.initialize() -Decay = GaudiPython.gbl.Decays.Decay +@pytest.fixture(scope="module") +def toolsvc(): + MessageSvc(OutputLevel=1) + DDDBConf() + app = AppMgr() + toolsvc = app.toolSvc() + app.initialize() + return toolsvc -@pytest.fixture() -def preambulo(): - decoder = toolsvc.create( +@pytest.fixture +def decoder(toolsvc): + return toolsvc.create( "DecodeSimpleDecayString", interface=GaudiPython.gbl.IDecodeSimpleDecayString ) - return decoder - -def test_descriptor_intact(preambulo): - decoder = preambulo +def test_descriptor_intact(decoder): descriptor = "[B+ -> K+ pi- mu+ e- p+ gamma pi0]cc" decoder.setDescriptor(descriptor) @@ -50,16 +48,14 @@ def test_descriptor_intact(preambulo): assert sc -def test_descriptor_bad_daughter(preambulo): - decoder = preambulo +def test_descriptor_bad_daughter(decoder): descriptor = "[B+ -> K+ pi- mu+ e- unicorn gamma pi0]cc" with pytest.raises(GaudiPython.gbl.GaudiException): decoder.setDescriptor(descriptor) -def test_descriptor_bad_mother(preambulo): - decoder = preambulo +def test_descriptor_bad_mother(decoder): descriptor = "[squirrel -> K+ pi- mu+ e- p+ gamma pi0]cc" with pytest.raises(GaudiPython.gbl.GaudiException): diff --git a/Phys/FunctorCore/CMakeLists.txt b/Phys/FunctorCore/CMakeLists.txt index e0f20c811ec4f96cea7936edb8be4f483a20668d..8ef5680d8aeb5e165a07f0365ec68f33e80c64e8 100644 --- a/Phys/FunctorCore/CMakeLists.txt +++ b/Phys/FunctorCore/CMakeLists.txt @@ -145,7 +145,7 @@ target_link_libraries(jit_includes_test gaudi_install(PYTHON) gaudi_add_tests(QMTest) -gaudi_add_tests(pytest ${CMAKE_CURRENT_SOURCE_DIR}/python) +gaudi_add_pytest(python) string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER) diff --git a/Phys/LoKiPhys/CMakeLists.txt b/Phys/LoKiPhys/CMakeLists.txt index 9641d5a5d81379b57907d85157c3890b0907087a..cc817a8eb253a0b58a86a61e4e041e939d762470 100644 --- a/Phys/LoKiPhys/CMakeLists.txt +++ b/Phys/LoKiPhys/CMakeLists.txt @@ -151,4 +151,4 @@ gaudi_add_executable(DecayGrammarTest gaudi_install(PYTHON) -gaudi_add_tests(pytest ${CMAKE_CURRENT_SOURCE_DIR}/python/LoKiPhys/tests.py) +gaudi_add_pytest(python) diff --git a/Phys/LoKiPhys/python/LoKiPhys/tests.py b/Phys/LoKiPhys/python/LoKiPhys/test_lokiphys.py similarity index 100% rename from Phys/LoKiPhys/python/LoKiPhys/tests.py rename to Phys/LoKiPhys/python/LoKiPhys/test_lokiphys.py