@@ -44,7 +44,7 @@ def test_checkPathNonExisting(self):
44
44
"""
45
45
err = StringIO ()
46
46
count = withStderrTo (err , lambda : checkPath ('extremo' ))
47
- self .assertEquals (err .getvalue (), 'extremo: no such file\n ' )
47
+ self .assertEquals (err .getvalue (), 'extremo: No such file or directory \n ' )
48
48
self .assertEquals (count , 1 )
49
49
50
50
@@ -113,7 +113,6 @@ def test_nonDefaultFollowsDefaultSyntaxError(self):
113
113
should include the line number of the syntax error. However these
114
114
exceptions do not include an offset.
115
115
"""
116
-
117
116
source = """\
118
117
def foo(bar=baz, bax):
119
118
pass
@@ -137,7 +136,6 @@ def test_nonKeywordAfterKeywordSyntaxError(self):
137
136
include the line number of the syntax error. However these exceptions
138
137
do not include an offset.
139
138
"""
140
-
141
139
source = """\
142
140
foo(bar=baz, bax)
143
141
"""
@@ -152,3 +150,18 @@ def test_nonKeywordAfterKeywordSyntaxError(self):
152
150
%s:1: non-keyword arg after keyword arg
153
151
foo(bar=baz, bax)
154
152
""" % (sourcePath .path ,))
153
+
154
+
155
+ def test_permissionDenied (self ):
156
+ """
157
+ If the a source file is not readable, this is reported on standard
158
+ error.
159
+ """
160
+ sourcePath = FilePath (self .mktemp ())
161
+ sourcePath .setContent ('' )
162
+ sourcePath .chmod (0 )
163
+ err = StringIO ()
164
+ count = withStderrTo (err , lambda : checkPath (sourcePath .path ))
165
+ self .assertEquals (count , 1 )
166
+ self .assertEquals (
167
+ err .getvalue (), "%s: Permission denied\n " % (sourcePath .path ,))
0 commit comments