summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-14 16:47:03 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-14 16:47:03 (GMT)
commit21d0e1b5fcc5a02a90f2424028d64a551d224d74 (patch)
tree61ebff324e2c2fc40c324db5566c67189666b7c1 /Lib
parent8c0f0c5c1ee8220eba26c4f3f72802a211e1d4fb (diff)
downloadcpython-21d0e1b5fcc5a02a90f2424028d64a551d224d74.zip
cpython-21d0e1b5fcc5a02a90f2424028d64a551d224d74.tar.gz
cpython-21d0e1b5fcc5a02a90f2424028d64a551d224d74.tar.bz2
Skip test_site if USER_SITE cannot be created
Issue #17758: Skip test_site if site.USER_SITE directory doesn't exist and cannot be created.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_site.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
index 6615080..da20a3d 100644
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -28,8 +28,13 @@ import site
if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE):
# need to add user site directory for tests
- os.makedirs(site.USER_SITE)
- site.addsitedir(site.USER_SITE)
+ try:
+ os.makedirs(site.USER_SITE)
+ site.addsitedir(site.USER_SITE)
+ except PermissionError as exc:
+ raise unittest.SkipTest('unable to create user site directory (%r): %s'
+ % (site.USER_SITE, exc))
+
class HelperFunctionsTests(unittest.TestCase):
"""Tests for helper functions.