Belle II Software
release-08-01-10
Main Page
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
v
w
x
z
Typedefs
a
b
c
d
e
g
i
k
l
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
e
f
g
n
p
s
v
z
Enumerator
c
d
f
p
t
u
v
w
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
l
m
o
p
r
s
t
u
v
Enumerator
a
b
c
d
e
f
g
h
k
l
m
n
o
p
r
s
t
u
v
w
z
Related Functions
b
c
d
g
i
o
r
s
t
Files
File List
File Members
All
Functions
Typedefs
Macros
test_server_detect_no_results.py
1
#!/usr/bin/env python3
2
3
10
11
import
sys
12
import
os
13
import
tempfile
14
import
validationpath
15
import
validationserver
16
17
18
def
main
():
19
"""
20
Test if the validationserver is able to detect if there is no
21
results folder available
22
"""
23
24
# will create a temporary folder and delete it once this block is left
25
with
tempfile.TemporaryDirectory()
as
tmpdir:
26
print(f
"Created temporary test folder {tmpdir}"
)
27
os.chdir(str(tmpdir))
28
29
# run validation server
30
fail =
False
31
try
:
32
validationserver.run_server
(dry_run=
True
)
33
fail =
True
34
except
SystemExit:
35
# we expect it to exit
36
pass
37
38
if
fail:
39
sys.exit(
"did not exit, even though there is no results folder"
)
40
41
# will create a temporary folder and delete it once this block is left
42
with
tempfile.TemporaryDirectory()
as
tmpdir:
43
print(f
"Created temporary test folder {tmpdir}"
)
44
os.chdir(str(tmpdir))
45
46
# create validation results folders, but still no folders inside
47
os.mkdir(
validationpath.get_results_folder
(os.getcwd()))
48
49
# run validation server
50
fail =
False
51
try
:
52
validationserver.run_server
(dry_run=
True
)
53
fail =
True
54
except
SystemExit:
55
# we expect it to exit
56
pass
57
58
if
fail:
59
sys.exit(
60
"did not exit, even though there is no folders in "
61
"results folder"
62
)
63
64
# will create a temporary folder and delete it once this block is left
65
with
tempfile.TemporaryDirectory()
as
tmpdir:
66
# should work when the folders are present
67
print(f
"Created temporary test folder {tmpdir}"
)
68
os.chdir(str(tmpdir))
69
70
# create validation results folders, but still no folders inside
71
os.mkdir(
validationpath.get_results_folder
(os.getcwd()))
72
os.mkdir(
validationpath.get_results_tag_folder
(os.getcwd(),
"some"
))
73
74
# run validation server
75
# should not raise any exit exceptions
76
validationserver.run_server
(dry_run=
True
)
77
78
79
if
__name__ ==
"__main__"
:
80
main
()
main
Definition:
main.py:1
main
int main(int argc, char **argv)
Run all tests.
Definition:
test_main.cc:91
validationpath.get_results_tag_folder
def get_results_tag_folder(output_base_dir, tag)
Definition:
validationpath.py:124
validationpath.get_results_folder
def get_results_folder(output_base_dir)
Definition:
validationpath.py:79
validationserver.run_server
def run_server(ip="127.0.0.1", port=8000, parse_command_line=False, open_site=False, dry_run=False)
Definition:
validationserver.py:876
validation
tests
test_server_detect_no_results.py
Generated on Mon Sep 23 2024 14:07:13 for Belle II Software by
1.9.1