Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 316f573

Browse files
committed
Issue #13304: Skip test case if user site-packages disabled (-s or
PYTHONNOUSERSITE). (Patch by Carl Meyer)
1 parent ce26014 commit 316f573

3 files changed

Lines changed: 7 additions & 1 deletion

File tree

Lib/test/test_site.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
else:
2525
raise unittest.SkipTest("importation of site.py suppressed")
2626

27-
if not os.path.isdir(site.USER_SITE):
27+
if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE):
2828
# need to add user site directory for tests
2929
os.makedirs(site.USER_SITE)
3030
site.addsitedir(site.USER_SITE)
@@ -157,6 +157,8 @@ def test_addsitedir(self):
157157
finally:
158158
pth_file.cleanup()
159159

160+
@unittest.skipUnless(site.ENABLE_USER_SITE, "requires access to PEP 370 "
161+
"user-site (site.ENABLE_USER_SITE)")
160162
def test_s_option(self):
161163
usersite = site.USER_SITE
162164
self.assertIn(usersite, sys.path)

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ Lucas Prado Melo
601601
Ezio Melotti
602602
Brian Merrell
603603
Luke Mewburn
604+
Carl Meyer
604605
Mike Meyer
605606
Steven Miale
606607
Trent Mick

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,9 @@ Library
187187
Tests
188188
-----
189189

190+
- Issue #13304: Skip test case if user site-packages disabled (-s or
191+
PYTHONNOUSERSITE). (Patch by Carl Meyer)
192+
190193
- Issue #13218: Fix test_ssl failures on Debian/Ubuntu.
191194

192195
- Issue #12821: Fix test_fcntl failures on OpenBSD 5.

0 commit comments

Comments
 (0)