File tree Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Expand file tree Collapse file tree 2 files changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Test for VfsPosix error conditions
2
+
3
+ try :
4
+ import os
5
+ import sys
6
+
7
+ os .VfsPosix
8
+ except (ImportError , AttributeError ):
9
+ print ("SKIP" )
10
+ raise SystemExit
11
+
12
+ if sys .platform == "win32" :
13
+ # Windows doesn't let you delete the current directory, so this cannot be
14
+ # tested.
15
+ print ("SKIP" )
16
+ raise SystemExit
17
+
18
+ # We need an empty directory for testing.
19
+ # Skip the test if it already exists.
20
+ temp_dir = "vfs_posix_enoent_test_dir"
21
+ try :
22
+ os .stat (temp_dir )
23
+ print ("SKIP" )
24
+ raise SystemExit
25
+ except OSError :
26
+ pass
27
+
28
+ curdir = os .getcwd ()
29
+ os .mkdir (temp_dir )
30
+ os .chdir (temp_dir )
31
+ os .rmdir (curdir + "/" + temp_dir )
32
+ try :
33
+ print ("getcwd():" , os .getcwd ())
34
+ except OSError as e :
35
+ # expecting ENOENT = 2
36
+ print ("getcwd():" , repr (e ))
37
+
38
+ try :
39
+ print ("VfsPosix():" , os .VfsPosix ("something" ))
40
+ except OSError as e :
41
+ # expecting ENOENT = 2
42
+ print ("VfsPosix():" , repr (e ))
Original file line number Diff line number Diff line change
1
+ getcwd(): OSError(2,)
2
+ VfsPosix(): OSError(2,)
You can’t perform that action at this time.
0 commit comments