ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
DataQualityConfigurations
python
DataQualityConfigurations/python/TestCases.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
2
3
4
import
unittest
5
import
os, sys
6
7
class
DQCTestCase
(unittest.TestCase):
8
def
setUp
(self):
9
self.
modlist
= []
10
11
def
do_imports
(self, verbose=False):
12
import
DataQualityConfigurations
13
for
i
in
DataQualityConfigurations.__all__:
14
if
verbose:
print
(
'Importing'
, i)
15
modname =
'DataQualityConfigurations.%s'
% i
16
__import__(modname)
17
self.
modlist
.append(sys.modules[modname])
18
19
def
test_01_ConfigsReadable
(self):
20
'''Test that we can read the python config files ok'''
21
self.
do_imports
(verbose=
True
)
22
self.assert_(len(self.
modlist
) > 0,
'Should have more than one config module'
)
23
24
def
test_02_ConfigsHaveConfigs
(self):
25
self.
do_imports
()
26
for
mod
in
self.
modlist
:
27
self.assert_(mod.dqconfig)
28
29
def
test_03_ConfigsPointAtGoodFiles
(self):
30
self.
do_imports
()
31
for
mod
in
self.
modlist
:
32
for
f
in
(
'hcfg'
,
'hcfg_min10'
,
'hcfg_min30'
):
33
mf = getattr(mod.dqconfig, f)
34
if
mf !=
''
:
35
self.failUnless(os.access(mf, os.R_OK),
36
'File %s not readable in configuration %s'
% (mf, mod.__name__) )
37
self.failUnless(
'/afs/cern.ch/user/a/atlasdqm/dqmdisk/tier0/han_config/'
in
mf,
38
'Invalid location %s for a production hcfg file in %s'
% (mf, mod.__name__) )
39
40
def
test_04_ModuleHandling
(self):
41
self.
do_imports
()
42
from
DataQualityConfigurations
import
getmodule
43
# OK for modules that should explicitly be around?
44
for
mod
in
self.
modlist
:
45
self.assertTrue(getmodule(mod.__name__.replace(
'DataQualityConfigurations.'
,
''
)))
46
47
# OK for some modules that do not exist?
48
for
mname
in
(
'data15_hi'
,
49
'data15_hip'
,
50
'data15_900GeV'
,
51
'data15_2p76TeV'
,
52
'data15_5TeV'
,
53
'data15_7TeV'
,
54
'data15_8TeV'
,
55
'data15_13TeV'
,
56
'data15_1beam'
,
57
'data15_cos'
,
58
'data15_calib'
,
59
'data15_calocomm'
,
60
'data15_larcomm'
,
61
'data15_tilecomm'
,
62
'data15_muoncomm'
,
63
'data15_idcomm'
,
64
'data15_comm'
,
65
'data15'
,
66
):
67
self.assertTrue(getmodule(mname))
68
69
# Fails otherwise?
70
self.assertRaises(ValueError, getmodule,
'NonExistentPtag'
)
71
72
def
suite
():
73
suite = unittest.TestLoader().loadTestsFromTestCase(DQCTestCase)
74
return
suite
75
76
if
__name__ ==
'__main__'
:
77
unittest.main()
python.TestCases.DQCTestCase
Definition
DataQualityConfigurations/python/TestCases.py:7
python.TestCases.DQCTestCase.test_03_ConfigsPointAtGoodFiles
test_03_ConfigsPointAtGoodFiles(self)
Definition
DataQualityConfigurations/python/TestCases.py:29
python.TestCases.DQCTestCase.setUp
setUp(self)
Definition
DataQualityConfigurations/python/TestCases.py:8
python.TestCases.DQCTestCase.test_04_ModuleHandling
test_04_ModuleHandling(self)
Definition
DataQualityConfigurations/python/TestCases.py:40
python.TestCases.DQCTestCase.modlist
list modlist
Definition
DataQualityConfigurations/python/TestCases.py:9
python.TestCases.DQCTestCase.do_imports
do_imports(self, verbose=False)
Definition
DataQualityConfigurations/python/TestCases.py:11
python.TestCases.DQCTestCase.test_02_ConfigsHaveConfigs
test_02_ConfigsHaveConfigs(self)
Definition
DataQualityConfigurations/python/TestCases.py:24
python.TestCases.DQCTestCase.test_01_ConfigsReadable
test_01_ConfigsReadable(self)
Definition
DataQualityConfigurations/python/TestCases.py:19
python.TestCases.suite
suite()
Definition
DataQualityConfigurations/python/TestCases.py:72
Generated on
for ATLAS Offline Software by
1.17.0