Module EDTestCaseEDUtilsPath
|
|
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 __authors__ = [ "Olof Svensson" ]
27 __contact__ = "svensson@esrf.fr"
28 __license__ = "LGPLv3+"
29 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
30
31 """
32 This is the test case for the EDUtilsFile static class.
33 """
34
35
36 import os, tempfile
37
38 from EDTestCase import EDTestCase
39 from EDVerbose import EDVerbose
40 from EDAssert import EDAssert
41 from EDUtilsFile import EDUtilsFile
42 from EDUtilsPath import EDUtilsPath
43
45
46
49
50
52
53 strUserTempFolder = EDUtilsPath.getEdnaUserTempFolder()
54 EDAssert.equal(True, os.path.exists(strUserTempFolder), "Checking that user temp folder exists")
55
56 strTest = "This is a test string."
57 strPathTestFile = os.path.join(strUserTempFolder, "EDTestCaseEDUtilsPath_testFile.txt")
58 EDUtilsFile.writeFile(strPathTestFile, strTest)
59 EDAssert.equal(True, os.path.exists(strPathTestFile), "Checking that new temp file exists")
60
61 os.remove(strPathTestFile)
62
63
64
65
68
69
70 if __name__ == '__main__':
71
72 edTestCaseEDUtilsPath = EDTestCaseEDUtilsPath("EDTestCaseEDUtilsPath")
73 edTestCaseEDUtilsPath.execute()
74