[Python-checkins] cpython (3.3): Issue #19828: Fixed test_site when the whole suite is run with -S.
zach.ware
python-checkins at python.org
Thu Dec 12 00:01:35 CET 2013
http://hg.python.org/cpython/rev/40884256f8dd
changeset: 87904:40884256f8dd
branch: 3.3
parent: 87901:d842bc07d30b
user: Zachary Ware <zachary.ware at gmail.com>
date: Wed Dec 11 16:59:44 2013 -0600
summary:
Issue #19828: Fixed test_site when the whole suite is run with -S.
Also, cleaned up an unused import.
files:
Lib/test/test_site.py | 17 ++++++++---------
Misc/NEWS | 2 ++
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/Lib/test/test_site.py b/Lib/test/test_site.py
--- a/Lib/test/test_site.py
+++ b/Lib/test/test_site.py
@@ -6,8 +6,7 @@
"""
import unittest
import test.support
-from test.support import run_unittest, TESTFN, EnvironmentVarGuard
-from test.support import captured_stderr
+from test.support import captured_stderr, TESTFN, EnvironmentVarGuard
import builtins
import os
import sys
@@ -19,13 +18,13 @@
import sysconfig
from copy import copy
-# Need to make sure to not import 'site' if someone specified ``-S`` at the
-# command-line. Detect this by just making sure 'site' has not been imported
-# already.
-if "site" in sys.modules:
- import site
-else:
- raise unittest.SkipTest("importation of site.py suppressed")
+# These tests are not particularly useful if Python was invoked with -S.
+# If you add tests that are useful under -S, this skip should be moved
+# to the class level.
+if sys.flags.no_site:
+ raise unittest.SkipTest("Python was invoked with -S")
+
+import site
if site.ENABLE_USER_SITE and not os.path.isdir(site.USER_SITE):
# need to add user site directory for tests
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -130,6 +130,8 @@
Tests
-----
+- Issue #19828: Fixed test_site when the whole suite is run with -S.
+
- Issue #19928: Implemented a test for repr() of cell objects.
- Issue #19535: Fixed test_docxmlrpc when python is run with -OO.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list