summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcfs-pure <cfs-pure@users.noreply.github.com>2017-02-04 09:50:30 -0800
committerIan Cordasco <sigmavirus24@users.noreply.github.com>2017-02-04 11:50:30 -0600
commit41148b45f797951057dc782682dd4055a4a3c1b6 (patch)
tree25ae98bb1a5c93fdcf6b7e2386c056661ccddbe6
parenta007c3d7f05b42647ef7d07be7c3afb3bb36ccdb (diff)
downloadpyflakes-41148b45f797951057dc782682dd4055a4a3c1b6.tar.gz
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
-rw-r--r--pyflakes/test/test_api.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pyflakes/test/test_api.py b/pyflakes/test/test_api.py
index 77ee33c..51b0027 100644
--- a/pyflakes/test/test_api.py
+++ b/pyflakes/test/test_api.py
@@ -518,6 +518,9 @@ foo = '\\xyz'
If the source file is not readable, this is reported on standard
error.
"""
+ if os.getuid() == 0:
+ self.skipTest('root user can access all files regardless of '
+ 'permissions')
sourcePath = self.makeTempFile('')
os.chmod(sourcePath, 0)
count, errors = self.getErrors(sourcePath)