forked from LLNL/Caliper
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_file_io.py
37 lines (25 loc) · 1.02 KB
/
test_file_io.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File and directory creation test cases
import os
import unittest
import calipertest as cat
class CaliperFileIOTest(unittest.TestCase):
""" Caliper file and directory creation test case """
def test_createdir(self):
target_cmd = [ './ci_test_macros', '0', 'hatchet-region-profile,use.mpi=false,output.format=json,output=foo/bar/test.json' ]
caliper_config = {
'CALI_LOG_VERBOSITY' : '0'
}
if os.path.exists('foo/bar/test.json'):
os.remove('foo/bar/test.json')
if os.path.exists('foo/bar'):
os.removedirs('foo/bar')
self.assertFalse(os.path.exists('foo/bar'))
cat.run_test(target_cmd, caliper_config)
self.assertTrue(os.path.isdir('foo/bar'))
self.assertTrue(os.path.isfile('foo/bar/test.json'))
if os.path.exists('foo/bar/test.json'):
os.remove('foo/bar/test.json')
if os.path.exists('foo/bar'):
os.removedirs('foo/bar')
if __name__ == "__main__":
unittest.main()