Skip to content

Commit 41148b4

Browse files
cfs-puresigmavirus24
authored andcommitted
Don't test against file perms when running as root (#86)
* Don't test against file perms when running as root test_permissionDenied tests file modes by creating a temporary file, then sets the mode to 0000 and attempts to process it and see if and permission denied error is generated. This never happens when the unit tests are run as root since it can open files regardless of file permissions. * Fix up UID skip in tests for Windows
1 parent a007c3d commit 41148b4

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

pyflakes/test/test_api.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,9 @@ def test_permissionDenied(self):
518518
If the source file is not readable, this is reported on standard
519519
error.
520520
"""
521+
if os.getuid() == 0:
522+
self.skipTest('root user can access all files regardless of '
523+
'permissions')
521524
sourcePath = self.makeTempFile('')
522525
os.chmod(sourcePath, 0)
523526
count, errors = self.getErrors(sourcePath)

0 commit comments

Comments
 (0)