summaryrefslogtreecommitdiffstats
path: root/Lib/test/support.py
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2011-09-19 10:26:31 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2011-09-19 10:26:31 (GMT)
commit2496f331a75c9dd30ef8588ae86179131227163a (patch)
tree90dd7c0d28d2a0196a9a2c60f097ea32b65aaba4 /Lib/test/support.py
parentb1e5d595afd15d3b84600883a5b60d1fbc6882e6 (diff)
downloadcpython-2496f331a75c9dd30ef8588ae86179131227163a.zip
cpython-2496f331a75c9dd30ef8588ae86179131227163a.tar.gz
cpython-2496f331a75c9dd30ef8588ae86179131227163a.tar.bz2
Close issue 12958 by flagging expected failures in test_socket on Mac OS X
Diffstat (limited to 'Lib/test/support.py')
-rw-r--r--Lib/test/support.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/support.py b/Lib/test/support.py
index 03af378..015564b 100644
--- a/Lib/test/support.py
+++ b/Lib/test/support.py
@@ -57,6 +57,7 @@ __all__ = [
"get_attribute", "swap_item", "swap_attr", "requires_IEEE_754",
"TestHandler", "Matcher", "can_symlink", "skip_unless_symlink",
"import_fresh_module", "requires_zlib", "PIPE_MAX_SIZE", "failfast",
+ "anticipate_failure"
]
class Error(Exception):
@@ -127,6 +128,17 @@ def _save_and_block_module(name, orig_modules):
return saved
+def anticipate_failure(condition):
+ """Decorator to mark a test that is known to be broken in some cases
+
+ Any use of this decorator should have a comment identifying the
+ associated tracker issue.
+ """
+ if condition:
+ return unittest.expectedFailure
+ return lambda f: f
+
+
def import_fresh_module(name, fresh=(), blocked=(), deprecated=False):
"""Imports and returns a module, deliberately bypassing the sys.modules cache
and importing a fresh copy of the module. Once the import is complete,