From 925c19636b27f98db524f6164763e86f2e3c305f Mon Sep 17 00:00:00 2001 From: Scott Snyder <scott.snyder@cern.ch> Date: Thu, 18 Jun 2020 12:01:34 +0000 Subject: [PATCH] AthenaCommon: Fix CFElements test. In run 2 mode, need to skip initialization of configurables if it's already been done. Otherwise, we'll get errors about duplicates. --- Control/AthenaCommon/python/CFElements.py | 26 +++++++++++-------- Control/AthenaCommon/share/CFElementsTest.ref | 17 ++++++++++++ 2 files changed, 32 insertions(+), 11 deletions(-) create mode 100644 Control/AthenaCommon/share/CFElementsTest.ref diff --git a/Control/AthenaCommon/python/CFElements.py b/Control/AthenaCommon/python/CFElements.py index df7e9e47a92..c7996cbdc32 100755 --- a/Control/AthenaCommon/python/CFElements.py +++ b/Control/AthenaCommon/python/CFElements.py @@ -1,4 +1,4 @@ -# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration +# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration from __future__ import print_function from AthenaConfiguration.ComponentFactory import CompFactory from AthenaCommon.Configurable import Configurable @@ -313,16 +313,20 @@ class TestLegacyCF( unittest.TestCase, TestCF ): from AthenaCommon.Configurable import ConfigurablePyAlgorithm Configurable.configurableRun3Behavior=0 top = parOR("top") - top += parOR("nest1") - nest2 = seqAND("nest2") - top += nest2 - top += ConfigurablePyAlgorithm("SomeAlg0") - nest2 += parOR("deep_nest1") - nest2 += parOR("deep_nest2") - - nest2 += ConfigurablePyAlgorithm("SomeAlg1") - nest2 += ConfigurablePyAlgorithm("SomeAlg2") - nest2 += ConfigurablePyAlgorithm("SomeAlg3") + + # Skip initialization if it's already been done... otherwise, we'll + # get errors about duplicates. + if not top.getChildren(): + top += parOR("nest1") + nest2 = seqAND("nest2") + top += nest2 + top += ConfigurablePyAlgorithm("SomeAlg0") + nest2 += parOR("deep_nest1") + nest2 += parOR("deep_nest2") + + nest2 += ConfigurablePyAlgorithm("SomeAlg1") + nest2 += ConfigurablePyAlgorithm("SomeAlg2") + nest2 += ConfigurablePyAlgorithm("SomeAlg3") self.top = top diff --git a/Control/AthenaCommon/share/CFElementsTest.ref b/Control/AthenaCommon/share/CFElementsTest.ref new file mode 100644 index 00000000000..0f9878b530f --- /dev/null +++ b/Control/AthenaCommon/share/CFElementsTest.ref @@ -0,0 +1,17 @@ +test_findAlgorithms (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findDeep (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findMissing (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findRespectingScope (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findTop (AthenaCommon.CFElements.TestConf2CF) ... ok +test_flatCollectors (AthenaCommon.CFElements.TestConf2CF) ... ok +test_findAlgorithms (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_findDeep (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_findMissing (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_findRespectingScope (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_findTop (AthenaCommon.CFElements.TestLegacyCF) ... ok +test_flatCollectors (AthenaCommon.CFElements.TestLegacyCF) ... ok + +---------------------------------------------------------------------- +Ran 12 tests in 0.002s + +OK -- GitLab