Belle II Software
light-2303-iriomote
test_embedding_example.py
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
4
11
12
import
os
13
import
sys
14
import
subprocess
15
import
unittest
16
from
basf2
import
find_file
17
from
b2test_utils
import
clean_working_directory
18
19
20
class
TestEmbedding
(unittest.TestCase):
21
"""Test to run the embedding example."""
22
23
@unittest.skipIf(not os.getenv('BELLE2_EXAMPLES_DATA_DIR')
,
24
"$BELLE2_EXAMPLES_DATA_DIR not found."
)
25
def
testEmbedding
(self):
26
"""
27
Test the embedding example.
28
"""
29
embedding_example = find_file(
'analysis/examples/embedding/embedding.py'
)
30
31
result = subprocess.run([
'basf2'
, embedding_example], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
32
if
result.returncode != 0:
33
# failure running tutorial so let's print the output
34
# on stderr so it's not split from output of unittest
35
# done like this since we don't want to decode/encode utf8
36
sys.stdout.buffer.write(result.stdout)
37
38
self.assertEqual(result.returncode, 0)
39
40
41
if
__name__ ==
'__main__'
:
42
with
clean_working_directory():
43
unittest.main()
test_embedding_example.TestEmbedding
Definition:
test_embedding_example.py:20
test_embedding_example.TestEmbedding.testEmbedding
def testEmbedding(self)
Definition:
test_embedding_example.py:25
analysis
tests
test_embedding_example.py
Generated on Thu Apr 6 2023 02:15:26 for Belle II Software by
1.9.1