ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
DataQuality
DQUtils
python
tests.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
2
3
from
pickle
import
dump, loads
4
from
functools
import
wraps
5
from
os
import
environ
6
from
importlib.resources
import
files
7
8
def
invariant
(test_data_name):
9
def
wrapper(func):
10
testfile =
"%s.%s"
% (func.__name__, test_data_name)
11
@wraps(func)
12
def
check_invariant(*args, **kwargs):
13
result = func(*args, **kwargs)
14
if
"DQU_UPDATE_TEST_DATA"
in
environ:
15
with
open(test_data_name,
"wb"
)
as
fd:
16
dump
(result, fd)
17
print
(
"Wrote updated test data"
)
18
else
:
19
test_data = loads(
files
(
"testdata"
).joinpath(testfile).read_bytes())
20
assert
result == test_data,
"Data considered 'invariant' has changed"
21
return
check_invariant
22
23
return
wrapper
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
files
std::vector< std::string > files
file names and file pointers
Definition
hcg.cxx:52
dump
-event-from-file
python.tests.invariant
invariant(test_data_name)
Definition
tests.py:8
Generated on
for ATLAS Offline Software by
1.17.0