Skip to content

Commit ec8d6c2

Browse files
committed
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.
1 parent d351827 commit ec8d6c2

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

Lib/test/test_site.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@
2626

2727
if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE):
2828
# need to add user site directory for tests
29-
os.makedirs(site.USER_SITE)
30-
site.addsitedir(site.USER_SITE)
29+
try:
30+
os.makedirs(site.USER_SITE)
31+
site.addsitedir(site.USER_SITE)
32+
except OSError as exc:
33+
raise unittest.SkipTest('unable to create user site directory (%r): %s'
34+
% (site.USER_SITE, exc))
35+
3136

3237
class HelperFunctionsTests(unittest.TestCase):
3338
"""Tests for helper functions.

0 commit comments

Comments
 (0)