The Gaudi Framework  master (29688f1e)
Loading...
Searching...
No Matches
GaudiKernel Namespace Reference

Namespaces

namespace  Configurable
namespace  ConfigurableDb
namespace  ConfigurableMeta
namespace  Constants
namespace  DataHandle
namespace  GaudiHandles
namespace  PhysicalConstants
namespace  ProcessJobOptions
namespace  PropertyProxy
namespace  Proxy
namespace  SystemOfUnits

Functions

 ROOT6WorkAroundEnabled (id=None)

Function Documentation

◆ ROOT6WorkAroundEnabled()

GaudiKernel.ROOT6WorkAroundEnabled ( id = None)
Helper function to easily exclude ROOT6 work-arounds for testing.

>>> os.environ['ROOT6_WORK_AROUND'] = 'all'
>>> ROOT6WorkAroundEnabled()
True
>>> os.environ['ROOT6_WORK_AROUND'] = 'none'
>>> ROOT6WorkAroundEnabled('JIRA-XYZ')
False
>>> os.environ['ROOT6_WORK_AROUND'] = 'JIRA-X'
>>> ROOT6WorkAroundEnabled('JIRA-X')
True
>>> ROOT6WorkAroundEnabled('JIRA-Y')
True
>>> os.environ['ROOT6_WORK_AROUND'] = 'JIRA-X,-JIRA-Y'
>>> ROOT6WorkAroundEnabled('JIRA-X')
True
>>> ROOT6WorkAroundEnabled('JIRA-Y')
False
>>> os.environ['ROOT6_WORK_AROUND'] = '-JIRA-Y'
>>> ROOT6WorkAroundEnabled('JIRA-X')
True
>>> ROOT6WorkAroundEnabled('JIRA-Y')
False

Definition at line 14 of file __init__.py.

14def ROOT6WorkAroundEnabled(id=None):
15 """
16 Helper function to easily exclude ROOT6 work-arounds for testing.
17
18 >>> os.environ['ROOT6_WORK_AROUND'] = 'all'
19 >>> ROOT6WorkAroundEnabled()
20 True
21 >>> os.environ['ROOT6_WORK_AROUND'] = 'none'
22 >>> ROOT6WorkAroundEnabled('JIRA-XYZ')
23 False
24 >>> os.environ['ROOT6_WORK_AROUND'] = 'JIRA-X'
25 >>> ROOT6WorkAroundEnabled('JIRA-X')
26 True
27 >>> ROOT6WorkAroundEnabled('JIRA-Y')
28 True
29 >>> os.environ['ROOT6_WORK_AROUND'] = 'JIRA-X,-JIRA-Y'
30 >>> ROOT6WorkAroundEnabled('JIRA-X')
31 True
32 >>> ROOT6WorkAroundEnabled('JIRA-Y')
33 False
34 >>> os.environ['ROOT6_WORK_AROUND'] = '-JIRA-Y'
35 >>> ROOT6WorkAroundEnabled('JIRA-X')
36 True
37 >>> ROOT6WorkAroundEnabled('JIRA-Y')
38 False
39 """
40 enabled = os.environ.get("ROOT6_WORK_AROUND", "all").lower()
41 if enabled == "all":
42 return True
43 if enabled in ("none", "no", "off", "false", "0"):
44 return False
45 if id is None: # unnamed work-arounds can only be disabled globally
46 return True
47 enabled = set(map(str.strip, enabled.split(",")))
48 disabled = set([e[1:] for e in enabled if e.startswith("-")])
49 id = id.lower()
50 # the w-a is enabled if in the enabled list or not explicitly disabled
51 return id in enabled or id not in disabled