Merge pull request #4597 from youknowone/expected-failure-if

Add unittset.expectedFailureIf for RustPython
This commit is contained in:
fanninpm
2023-03-02 09:49:52 -05:00
committed by GitHub
33 changed files with 106 additions and 356 deletions

View File

@@ -26,6 +26,7 @@ codecs.register(codec_search_function)
codecname = 'testcodec'
class CharmapCodecTest(unittest.TestCase):
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_constructorx(self):
self.assertEqual(str(b'abc', codecname), 'abc')
self.assertEqual(str(b'xdef', codecname), 'abcdef')
@@ -42,24 +43,16 @@ class CharmapCodecTest(unittest.TestCase):
self.assertEqual('dxf'.encode(codecname), b'dabcf')
self.assertEqual('dxfx'.encode(codecname), b'dabcfabc')
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_constructory(self):
self.assertEqual(str(b'ydef', codecname), 'def')
self.assertEqual(str(b'defy', codecname), 'def')
self.assertEqual(str(b'dyf', codecname), 'df')
self.assertEqual(str(b'dyfy', codecname), 'df')
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_maptoundefined(self):
self.assertRaises(UnicodeError, str, b'abc\001', codecname)
# TODO: RUSTPYTHON
import sys
if sys.platform == "win32":
# TODO: RUSTPYTHON
test_constructorx = unittest.expectedFailure(test_constructorx)
# TODO: RUSTPYTHON
test_constructory = unittest.expectedFailure(test_constructory)
# TODO: RUSTPYTHON
test_maptoundefined = unittest.expectedFailure(test_maptoundefined)
if __name__ == "__main__":
unittest.main()

View File

@@ -1793,6 +1793,7 @@ class CodecsModuleTest(unittest.TestCase):
self.assertEqual(codecs.decode(b'[\xff]', 'ascii', errors='ignore'),
'[]')
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_encode(self):
self.assertEqual(codecs.encode('\xe4\xf6\xfc', 'latin-1'),
b'\xe4\xf6\xfc')
@@ -1807,14 +1808,11 @@ class CodecsModuleTest(unittest.TestCase):
self.assertEqual(codecs.encode('[\xff]', 'ascii', errors='ignore'),
b'[]')
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_encode = unittest.expectedFailure(test_encode)
def test_register(self):
self.assertRaises(TypeError, codecs.register)
self.assertRaises(TypeError, codecs.register, 42)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AttributeError: module '_winapi' has no attribute 'GetACP'")
def test_unregister(self):
name = "nonexistent_codec_name"
search_function = mock.Mock()
@@ -1827,51 +1825,32 @@ class CodecsModuleTest(unittest.TestCase):
self.assertRaises(LookupError, codecs.lookup, name)
search_function.assert_not_called()
# TODO: RUSTPYTHON, AttributeError: module '_winapi' has no attribute 'GetACP'
if sys.platform == "win32":
test_unregister = unittest.expectedFailure(test_unregister)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_lookup(self):
self.assertRaises(TypeError, codecs.lookup)
self.assertRaises(LookupError, codecs.lookup, "__spam__")
self.assertRaises(LookupError, codecs.lookup, " ")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_lookup = unittest.expectedFailure(test_lookup)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_getencoder(self):
self.assertRaises(TypeError, codecs.getencoder)
self.assertRaises(LookupError, codecs.getencoder, "__spam__")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_getencoder = unittest.expectedFailure(test_getencoder)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_getdecoder(self):
self.assertRaises(TypeError, codecs.getdecoder)
self.assertRaises(LookupError, codecs.getdecoder, "__spam__")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_getdecoder = unittest.expectedFailure(test_getdecoder)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_getreader(self):
self.assertRaises(TypeError, codecs.getreader)
self.assertRaises(LookupError, codecs.getreader, "__spam__")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_getreader = unittest.expectedFailure(test_getreader)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_getwriter(self):
self.assertRaises(TypeError, codecs.getwriter)
self.assertRaises(LookupError, codecs.getwriter, "__spam__")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_getwriter = unittest.expectedFailure(test_getwriter)
def test_lookup_issue1813(self):
# Issue #1813: under Turkish locales, lookup of some codecs failed
# because 'I' is lowercased as "ı" (dotless i)
@@ -1926,6 +1905,7 @@ class CodecsModuleTest(unittest.TestCase):
self.assertRaises(UnicodeError,
codecs.decode, b'abc', 'undefined', errors)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_file_closes_if_lookup_error_raised(self):
mock_open = mock.mock_open()
with mock.patch('builtins.open', mock_open) as file:
@@ -1934,11 +1914,6 @@ class CodecsModuleTest(unittest.TestCase):
file().close.assert_called()
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_file_closes_if_lookup_error_raised = unittest.expectedFailure(test_file_closes_if_lookup_error_raised)
class StreamReaderTest(unittest.TestCase):
def setUp(self):
@@ -3190,51 +3165,37 @@ class ExceptionChainingTest(unittest.TestCase):
with self.assertRaisesRegex(RuntimeError, msg):
codecs.decode(b"bytes input", self.codec_name)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_init_override_is_not_wrapped(self):
class CustomInit(RuntimeError):
def __init__(self):
pass
self.check_not_wrapped(CustomInit, "")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_init_override_is_not_wrapped = unittest.expectedFailure(test_init_override_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_new_override_is_not_wrapped(self):
class CustomNew(RuntimeError):
def __new__(cls):
return super().__new__(cls)
self.check_not_wrapped(CustomNew, "")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_new_override_is_not_wrapped = unittest.expectedFailure(test_new_override_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_instance_attribute_is_not_wrapped(self):
msg = "This should NOT be wrapped"
exc = RuntimeError(msg)
exc.attr = 1
self.check_not_wrapped(exc, "^{}$".format(msg))
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_instance_attribute_is_not_wrapped = unittest.expectedFailure(test_instance_attribute_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_non_str_arg_is_not_wrapped(self):
self.check_not_wrapped(RuntimeError(1), "1")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_non_str_arg_is_not_wrapped = unittest.expectedFailure(test_non_str_arg_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_multiple_args_is_not_wrapped(self):
msg_re = r"^\('a', 'b', 'c'\)$"
self.check_not_wrapped(RuntimeError('a', 'b', 'c'), msg_re)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_multiple_args_is_not_wrapped = unittest.expectedFailure(test_multiple_args_is_not_wrapped)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
# http://bugs.python.org/issue19609
def test_codec_lookup_failure_not_wrapped(self):
msg = "^unknown encoding: {}$".format(self.codec_name)
@@ -3248,10 +3209,6 @@ class ExceptionChainingTest(unittest.TestCase):
with self.assertRaisesRegex(LookupError, msg):
codecs.decode(b"bytes input", self.codec_name)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_codec_lookup_failure_not_wrapped = unittest.expectedFailure(test_codec_lookup_failure_not_wrapped)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_unflagged_non_text_codec_handling(self):

View File

@@ -186,7 +186,7 @@ just fits in two lineS yup!!
the end"""
class TestSFpatches(unittest.TestCase):
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_html_diff(self):
# Check SF patch 914575 for generating HTML differences
f1a = ((patch914575_from1 + '123\n'*10)*3)
@@ -244,10 +244,6 @@ class TestSFpatches(unittest.TestCase):
with open(findfile('test_difflib_expect.html')) as fp:
self.assertEqual(actual, fp.read())
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_html_diff = unittest.expectedFailure(test_html_diff)
def test_recursion_limit(self):
# Check if the problem described in patch #1413711 exists.
limit = sys.getrecursionlimit()

View File

@@ -80,6 +80,7 @@ class HierarchyTest(unittest.TestCase):
return _map
_map = _make_map(_pep_map)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_errno_mapping(self):
# The OSError constructor maps errnos to subclasses
# A sample test for the basic functionality
@@ -94,11 +95,6 @@ class HierarchyTest(unittest.TestCase):
e = OSError(errcode, "Some message")
self.assertIs(type(e), OSError)
# TODO: RUSTPYTHON
import sys
if sys.platform == 'win32':
test_errno_mapping = unittest.expectedFailure(test_errno_mapping)
def test_try_except(self):
filename = "some_hopefully_non_existing_file"

View File

@@ -368,6 +368,7 @@ class FaultHandlerTests(unittest.TestCase):
'Segmentation fault',
all_threads=False)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AttributeError: module 'msvcrt' has no attribute 'GetErrorMode'")
@skip_segfault_on_android
def test_disable(self):
code = """
@@ -383,9 +384,6 @@ class FaultHandlerTests(unittest.TestCase):
"%r is present in %r" % (not_expected, stderr))
self.assertNotEqual(exitcode, 0)
if sys.platform == "win32": # TODO: RUSTPYTHON, AttributeError: module 'msvcrt' has no attribute 'GetErrorMode'
test_disable = unittest.expectedFailure(test_disable)
# TODO: RUSTPYTHON
@unittest.expectedFailure
@skip_segfault_on_android

View File

@@ -221,9 +221,6 @@ class AutoFileTests:
self.assertRaises(ValueError, self.f.writelines, b'')
def testOpendir(self):
# TODO: RUSTPYTHON
if sys.platform == "win32":
testOpendir = unittest.expectedFailure(testOpendir)
# Issue 3703: opening a directory should fill the errno
# Windows always returns "[Errno 13]: Permission denied
# Unix uses fstat and returns "[Errno 21]: Is a directory"
@@ -381,8 +378,7 @@ class CAutoFileTests(AutoFileTests, unittest.TestCase):
def testOpenDirFD(self):
super().testOpenDirFD()
# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.expectedFailureIf(sys.platform != "win32", "TODO: RUSTPYTHON")
def testOpendir(self):
super().testOpendir()

View File

@@ -71,16 +71,12 @@ class FnmatchTestCase(unittest.TestCase):
check('usr/bin', 'usr\\bin', False, fnmatchcase)
check('usr\\bin', 'usr\\bin', True, fnmatchcase)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_bytes(self):
self.check_match(b'test', b'te*')
self.check_match(b'test\xff', b'te*\xff')
self.check_match(b'foo\nbar', b'foo*')
# TODO: RUSTPYTHON
import sys
if sys.platform == 'win32':
test_bytes = unittest.expectedFailure(test_bytes)
def test_case(self):
ignorecase = os.path.normcase('ABC') == os.path.normcase('abc')
check = self.check_match

View File

@@ -242,14 +242,11 @@ class GenericTest:
create_file(test_fn2)
self.assertFalse(self.pathmodule.samefile(test_fn1, test_fn2))
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; properly implement stat st_dev/st_ino")
@os_helper.skip_unless_symlink
def test_samefile_on_symlink(self):
self._test_samefile_on_link_func(os.symlink)
if sys.platform == 'win32':
# TODO: RUSTPYTHON, properly implement stat st_dev/st_ino
test_samefile_on_symlink = unittest.expectedFailure(test_samefile_on_symlink)
def test_samefile_on_link(self):
try:
self._test_samefile_on_link_func(os.link)
@@ -288,14 +285,11 @@ class GenericTest:
self.assertFalse(self.pathmodule.samestat(os.stat(test_fn1),
os.stat(test_fn2)))
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; properly implement stat st_dev/st_ino")
@os_helper.skip_unless_symlink
def test_samestat_on_symlink(self):
self._test_samestat_on_link_func(os.symlink)
if sys.platform == 'win32':
# TODO: RUSTPYTHON, properly implement stat st_dev/st_ino
test_samestat_on_symlink = unittest.expectedFailure(test_samestat_on_symlink)
def test_samestat_on_link(self):
try:
self._test_samestat_on_link_func(os.link)

View File

@@ -708,6 +708,7 @@ class TestOpen(BaseTest):
with self.assertRaises(ValueError):
gzip.open(self.filename, "rb", newline="\n")
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_encoding(self):
# Test non-default encoding.
uncompressed = data1.decode("ascii") * 50
@@ -720,11 +721,6 @@ class TestOpen(BaseTest):
with gzip.open(self.filename, "rt", encoding="utf-16") as f:
self.assertEqual(f.read(), uncompressed)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_encoding = unittest.expectedFailure(test_encoding)
def test_encoding_error_handler(self):
# Test with non-default encoding error handler.
with gzip.open(self.filename, "wb") as f:

View File

@@ -81,6 +81,7 @@ class ImportTests(unittest.TestCase):
with self.assertRaises(SyntaxError):
imp.find_module('badsyntax_pep3120', path)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_issue1267(self):
for mod, encoding, _ in self.test_strings:
fp, filename, info = imp.find_module('module_' + mod,
@@ -100,10 +101,6 @@ class ImportTests(unittest.TestCase):
self.assertEqual(fp.readline(),
'"""Tokenization help for Python programs.\n')
# TODO: RUSTPYTHON
if sys.platform == 'win32':
test_issue1267 = unittest.expectedFailure(test_issue1267)
def test_issue3594(self):
temp_mod_name = 'test_imp_helper'
sys.path.insert(0, '.')

View File

@@ -168,6 +168,7 @@ class FinderTests(abc.FinderTests):
found = self._find(finder, 'doesnotexist')
self.assertEqual(found, self.NOT_FOUND)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_ignore_file(self):
# If a directory got changed to a file from underneath us, then don't
# worry about looking for submodules.
@@ -176,10 +177,6 @@ class FinderTests(abc.FinderTests):
found = self._find(finder, 'doesnotexist')
self.assertEqual(found, self.NOT_FOUND)
# TODO: RUSTPYTHON
if sys.platform == 'win32':
test_ignore_file = unittest.expectedFailure(test_ignore_file)
class FinderTestsPEP451(FinderTests):

View File

@@ -260,16 +260,13 @@ class ThreadedImportTests(unittest.TestCase):
'partial', 'cfimport.py')
script_helper.assert_python_ok(fn)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_multiprocessing_pool_circular_import(self):
# Regression test for bpo-41567
fn = os.path.join(os.path.dirname(__file__),
'partial', 'pool_in_threads.py')
script_helper.assert_python_ok(fn)
# TODO: RUSTPYTHON
if sys.platform == 'win32':
test_multiprocessing_pool_circular_import = unittest.expectedFailure(test_multiprocessing_pool_circular_import)
def setUpModule():
thread_info = threading_helper.threading_setup()

View File

@@ -510,6 +510,7 @@ class NormalizeTest(unittest.TestCase):
class TestMiscellaneous(unittest.TestCase):
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_defaults_UTF8(self):
# Issue #18378: on (at least) macOS setting LC_CTYPE to "UTF-8" is
# valid. Furthermore LC_CTYPE=UTF is used by the UTF-8 locale coercing
@@ -546,10 +547,6 @@ class TestMiscellaneous(unittest.TestCase):
if orig_getlocale is not None:
_locale._getdefaultlocale = orig_getlocale
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_defaults_UTF8 = unittest.expectedFailure(test_defaults_UTF8)
def test_getencoding(self):
# Invoke getencoding to make sure it does not cause exceptions.
@@ -571,6 +568,7 @@ class TestMiscellaneous(unittest.TestCase):
self.assertRaises(TypeError, locale.strcoll, "a", None)
self.assertRaises(TypeError, locale.strcoll, b"a", None)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_setlocale_category(self):
locale.setlocale(locale.LC_ALL)
locale.setlocale(locale.LC_TIME)
@@ -581,10 +579,6 @@ class TestMiscellaneous(unittest.TestCase):
# crasher from bug #7419
self.assertRaises(locale.Error, locale.setlocale, 12345)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_setlocale_category = unittest.expectedFailure(test_setlocale_category)
def test_getsetlocale_issue1813(self):
# Issue #1813: setting and getting the locale under a Turkish locale

View File

@@ -508,6 +508,7 @@ class TestNtpath(NtpathTestCase):
with os_helper.change_cwd(test_dir_short):
self.assertPathEqual(test_file_long, ntpath.realpath("file.txt"))
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; ValueError: illegal environment variable name")
def test_expandvars(self):
with os_helper.EnvironmentVarGuard() as env:
env.clear()
@@ -534,10 +535,7 @@ class TestNtpath(NtpathTestCase):
tester('ntpath.expandvars("\'%foo%\'%bar")', "\'%foo%\'%bar")
tester('ntpath.expandvars("bar\'%foo%")', "bar\'%foo%")
# TODO: RUSTPYTHON, ValueError: illegal environment variable name
if sys.platform == 'win32':
test_expandvars = unittest.expectedFailure(test_expandvars)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; ValueError: illegal environment variable name")
@unittest.skipUnless(os_helper.FS_NONASCII, 'need os_helper.FS_NONASCII')
def test_expandvars_nonascii(self):
def check(value, expected):
@@ -558,10 +556,7 @@ class TestNtpath(NtpathTestCase):
check('%spam%bar', '%sbar' % nonascii)
check('%{}%bar'.format(nonascii), 'ham%sbar' % nonascii)
# TODO: RUSTPYTHON, ValueError: illegal environment variable name
if sys.platform == 'win32':
test_expandvars_nonascii = unittest.expectedFailure(test_expandvars_nonascii)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_expanduser(self):
tester('ntpath.expanduser("test")', 'test')
@@ -609,10 +604,6 @@ class TestNtpath(NtpathTestCase):
tester('ntpath.expanduser("~test")', '~test')
tester('ntpath.expanduser("~")', 'C:\\Users\\eric')
# TODO: RUSTPYTHON
if sys.platform == 'win32':
test_expanduser = unittest.expectedFailure(test_expanduser)
@unittest.skipUnless(nt, "abspath requires 'nt' module")
def test_abspath(self):
tester('ntpath.abspath("C:\\")', "C:\\")
@@ -716,6 +707,7 @@ class TestNtpath(NtpathTestCase):
self.assertRaises(TypeError, ntpath.commonpath,
['Program Files', b'C:\\Program Files\\Foo'])
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_sameopenfile(self):
with TemporaryFile() as tf1, TemporaryFile() as tf2:
# Make sure the same file is really the same
@@ -729,10 +721,6 @@ class TestNtpath(NtpathTestCase):
# dialogs (#4804)
ntpath.sameopenfile(-1, -1)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_sameopenfile = unittest.expectedFailure(test_sameopenfile)
def test_ismount(self):
self.assertTrue(ntpath.ismount("c:\\"))
self.assertTrue(ntpath.ismount("C:\\"))
@@ -859,15 +847,12 @@ class PathLikeTests(NtpathTestCase):
def _check_function(self, func):
self.assertPathEqual(func(self.file_path), func(self.file_name))
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AssertionError: 'ωω' != 'ωΩ'")
def test_path_normcase(self):
self._check_function(self.path.normcase)
if sys.platform == 'win32':
self.assertEqual(ntpath.normcase('\u03a9\u2126'), 'ωΩ')
# TODO: RUSTPYTHON, AssertionError: 'ωω' != 'ωΩ'
if sys.platform == "win32":
test_path_normcase = unittest.expectedFailure(test_path_normcase)
def test_path_isabs(self):
self._check_function(self.path.isabs)

View File

@@ -78,16 +78,13 @@ class PlatformTest(unittest.TestCase):
def test_architecture(self):
res = platform.architecture()
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
@os_helper.skip_unless_symlink
def test_architecture_via_symlink(self): # issue3762
with support.PythonSymlink() as py:
cmd = "-c", "import platform; print(platform.architecture())"
self.assertEqual(py.call_real(*cmd), py.call_link(*cmd))
# TODO: RUSTPYTHON; _winapi.GetModuleFileName
if sys.platform == 'win32':
test_architecture_via_symlink = unittest.expectedFailure(test_architecture_via_symlink)
def test_platform(self):
for aliased in (False, True):
for terse in (False, True):

View File

@@ -53,22 +53,16 @@ class PopenTest(unittest.TestCase):
else:
self.assertEqual(os.waitstatus_to_exitcode(status), 42)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_contextmanager(self):
with os.popen("echo hello") as f:
self.assertEqual(f.read(), "hello\n")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_contextmanager = unittest.expectedFailure(test_contextmanager)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_iterating(self):
with os.popen("echo hello") as f:
self.assertEqual(list(f), ["hello\n"])
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_iterating = unittest.expectedFailure(test_iterating)
def test_keywords(self):
with os.popen(cmd="exit 0", mode="w", buffering=-1):
pass

View File

@@ -154,6 +154,7 @@ class PosixPathTest(unittest.TestCase):
self.assertEqual(posixpath.dirname(b"////foo"), b"////")
self.assertEqual(posixpath.dirname(b"//foo//bar"), b"//foo")
@unittest.expectedFailureIf(os.name == "nt", "TODO: RUSTPYTHON")
def test_islink(self):
self.assertIs(posixpath.islink(os_helper.TESTFN + "1"), False)
self.assertIs(posixpath.lexists(os_helper.TESTFN + "2"), False)
@@ -175,10 +176,6 @@ class PosixPathTest(unittest.TestCase):
self.assertIs(posixpath.islink(os_helper.TESTFN + "\x00"), False)
self.assertIs(posixpath.islink(os.fsencode(os_helper.TESTFN) + b"\x00"), False)
# TODO: RUSTPYTHON
if os.name == "nt":
test_islink = unittest.expectedFailure(test_islink)
def test_ismount(self):
self.assertIs(posixpath.ismount("/"), True)
self.assertIs(posixpath.ismount(b"/"), True)
@@ -197,6 +194,7 @@ class PosixPathTest(unittest.TestCase):
self.assertIs(posixpath.ismount('/\x00'), False)
self.assertIs(posixpath.ismount(b'/\x00'), False)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
@unittest.skipUnless(os_helper.can_symlink(),
"Test requires symlink support")
def test_ismount_symlinks(self):
@@ -207,10 +205,6 @@ class PosixPathTest(unittest.TestCase):
finally:
os.unlink(ABSTFN)
# TODO: RUSTPYTHON
if os.name == "nt":
test_ismount_symlinks = unittest.expectedFailure(test_ismount_symlinks)
@unittest.skipIf(posix is None, "Test requires posix module")
def test_ismount_different_device(self):
# Simulate the path being on a different device from its parent by

View File

@@ -78,6 +78,7 @@ class PyCompileTestsBase:
self.assertTrue(os.path.exists(self.pyc_path))
self.assertFalse(os.path.exists(self.cache_path))
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_do_not_overwrite_symlinks(self):
# In the face of a cfile argument being a symlink, bail out.
# Issue #17222
@@ -90,10 +91,6 @@ class PyCompileTestsBase:
with self.assertRaises(FileExistsError):
py_compile.compile(self.source_path, self.pyc_path)
# TODO: RUSTPYTHON
if sys.platform == 'win32':
test_do_not_overwrite_symlinks = unittest.expectedFailure(test_do_not_overwrite_symlinks)
@unittest.skipIf(not os.path.exists(os.devnull) or os.path.isfile(os.devnull),
'requires os.devnull and for it to be a non-regular file')
def test_do_not_overwrite_nonregular_files(self):
@@ -113,17 +110,14 @@ class PyCompileTestsBase:
self.assertTrue(os.path.exists(self.pyc_path))
self.assertFalse(os.path.exists(self.cache_path))
import platform
@unittest.expectedFailureIf(sys.platform == "darwin" and int(platform.release().split(".")[0]) < 20, "TODO: RUSTPYTHON")
def test_relative_path(self):
py_compile.compile(os.path.relpath(self.source_path),
os.path.relpath(self.pyc_path))
self.assertTrue(os.path.exists(self.pyc_path))
self.assertFalse(os.path.exists(self.cache_path))
# TODO: RUSTPYTHON
import platform
if sys.platform == "darwin" and int(platform.release().split(".")[0]) < 20:
test_relative_path = unittest.expectedFailure(test_relative_path)
@unittest.skipIf(hasattr(os, 'geteuid') and os.geteuid() == 0,
'non-root user required')
@unittest.skipIf(os.name == 'nt',
@@ -273,6 +267,7 @@ class PyCompileCLITestCase(unittest.TestCase):
self.assertEqual(stdout, b'')
self.assertEqual(stderr, b'')
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_file_not_exists(self):
should_not_exists = os.path.join(os.path.dirname(__file__), 'should_not_exists.py')
rc, stdout, stderr = self.pycompilecmd_failure(self.source_path, should_not_exists)
@@ -280,10 +275,6 @@ class PyCompileCLITestCase(unittest.TestCase):
self.assertEqual(stdout, b'')
self.assertIn(b'no such file or directory', stderr.lower())
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_file_not_exists = unittest.expectedFailure(test_file_not_exists)
def test_file_not_exists_with_quiet(self):
should_not_exists = os.path.join(os.path.dirname(__file__), 'should_not_exists.py')
rc, stdout, stderr = self.pycompilecmd_failure('-q', self.source_path, should_not_exists)

View File

@@ -790,9 +790,11 @@ class TestExit(unittest.TestCase):
self.assertTrue(proc.stderr.endswith("\nKeyboardInterrupt\n"))
self.assertEqual(proc.returncode, self.EXPECTED_CODE)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_pymain_run_file(self):
self.assertSigInt([sys.executable, self.ham])
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_pymain_run_file_runpy_run_module(self):
tmp = self.ham.parent
run_module = tmp / "run_module.py"
@@ -806,6 +808,7 @@ class TestExit(unittest.TestCase):
)
self.assertSigInt([sys.executable, run_module], cwd=tmp)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_pymain_run_file_runpy_run_module_as_main(self):
tmp = self.ham.parent
run_module_as_main = tmp / "run_module_as_main.py"
@@ -819,12 +822,14 @@ class TestExit(unittest.TestCase):
)
self.assertSigInt([sys.executable, run_module_as_main], cwd=tmp)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_pymain_run_command_run_module(self):
self.assertSigInt(
[sys.executable, "-c", "import runpy; runpy.run_module('ham')"],
cwd=self.ham.parent,
)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_pymain_run_command(self):
self.assertSigInt([sys.executable, "-c", "import ham"], cwd=self.ham.parent)
@@ -833,23 +838,11 @@ class TestExit(unittest.TestCase):
def test_pymain_run_stdin(self):
self.assertSigInt([sys.executable], input="import ham", cwd=self.ham.parent)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_pymain_run_module(self):
ham = self.ham
self.assertSigInt([sys.executable, "-m", ham.stem], cwd=ham.parent)
# TODO: RUSTPYTHON
if sys.platform == "win32":
windows_only_failed_tests = [
test_pymain_run_file,
test_pymain_run_file_runpy_run_module,
test_pymain_run_file_runpy_run_module_as_main,
test_pymain_run_command_run_module,
test_pymain_run_command,
test_pymain_run_module
]
for t in windows_only_failed_tests:
unittest.expectedFailure(t)
if __name__ == "__main__":
unittest.main()

View File

@@ -128,6 +128,7 @@ class BaseSelectorTestCase:
s.unregister(r)
s.unregister(w)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_unregister_after_socket_close(self):
s = self.SELECTOR()
self.addCleanup(s.close)
@@ -139,10 +140,6 @@ class BaseSelectorTestCase:
s.unregister(rd)
s.unregister(wr)
# TODO: RUSTPYTHON
if sys.platform == 'win32':
test_unregister_after_socket_close = unittest.expectedFailure(test_unregister_after_socket_close)
def test_modify(self):
s = self.SELECTOR()
self.addCleanup(s.close)

View File

@@ -178,15 +178,13 @@ class WakeupFDTests(unittest.TestCase):
with self.assertRaises(TypeError):
signal.set_wakeup_fd(signal.SIGINT, False)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_invalid_fd(self):
fd = os_helper.make_bad_fd()
self.assertRaises((ValueError, OSError),
signal.set_wakeup_fd, fd)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_invalid_fd = unittest.expectedFailure(test_invalid_fd)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_invalid_socket(self):
sock = socket.socket()
fd = sock.fileno()
@@ -194,10 +192,7 @@ class WakeupFDTests(unittest.TestCase):
self.assertRaises((ValueError, OSError),
signal.set_wakeup_fd, fd)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_invalid_socket = unittest.expectedFailure(test_invalid_socket)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_set_wakeup_fd_result(self):
r1, w1 = os.pipe()
self.addCleanup(os.close, r1)
@@ -215,10 +210,7 @@ class WakeupFDTests(unittest.TestCase):
self.assertEqual(signal.set_wakeup_fd(-1), w2)
self.assertEqual(signal.set_wakeup_fd(-1), -1)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_set_wakeup_fd_result = unittest.expectedFailure(test_set_wakeup_fd_result)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_set_wakeup_fd_socket_result(self):
sock1 = socket.socket()
self.addCleanup(sock1.close)
@@ -235,10 +227,6 @@ class WakeupFDTests(unittest.TestCase):
self.assertEqual(signal.set_wakeup_fd(-1), fd2)
self.assertEqual(signal.set_wakeup_fd(-1), -1)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_set_wakeup_fd_socket_result = unittest.expectedFailure(test_set_wakeup_fd_socket_result)
# On Windows, files are always blocking and Windows does not provide a
# function to test if a socket is in non-blocking mode.
@unittest.skipIf(sys.platform == "win32", "tests specific to POSIX")

View File

@@ -1576,6 +1576,7 @@ class GeneralModuleTests(unittest.TestCase):
# only IP addresses are allowed
self.assertRaises(OSError, socket.getnameinfo, ('mail.python.org',0), 0)
@unittest.expectedFailureIf(sys.platform != "darwin", "TODO: RUSTPYTHON; socket.gethostbyname_ex")
@unittest.skipUnless(support.is_resource_enabled('network'),
'network is not enabled')
def test_idna(self):
@@ -1593,10 +1594,6 @@ class GeneralModuleTests(unittest.TestCase):
# have a reverse entry yet
# socket.gethostbyaddr('испытание.python.org')
# TODO: RUSTPYTHON, socket.gethostbyname_ex
if sys.platform != "darwin":
test_idna = unittest.expectedFailure(test_idna)
def check_sendall_interrupted(self, with_timeout):
# socketpair() is not strictly required, but it makes things easier.
if not hasattr(signal, 'alarm') or not hasattr(socket, 'socketpair'):
@@ -1811,6 +1808,7 @@ class GeneralModuleTests(unittest.TestCase):
self.assertEqual(str(s.family), 'AddressFamily.AF_INET')
self.assertEqual(str(s.type), 'SocketKind.SOCK_STREAM')
@unittest.expectedFailureIf(sys.platform.startswith("linux"), "TODO: RUSTPYTHON, AssertionError: 526337 != <SocketKind.SOCK_STREAM: 1>")
def test_socket_consistent_sock_type(self):
SOCK_NONBLOCK = getattr(socket, 'SOCK_NONBLOCK', 0)
SOCK_CLOEXEC = getattr(socket, 'SOCK_CLOEXEC', 0)
@@ -1827,10 +1825,6 @@ class GeneralModuleTests(unittest.TestCase):
s.setblocking(False)
self.assertEqual(s.type, socket.SOCK_STREAM)
# TODO: RUSTPYTHON, AssertionError: 526337 != <SocketKind.SOCK_STREAM: 1>
if sys.platform == "linux":
test_socket_consistent_sock_type = unittest.expectedFailure(test_socket_consistent_sock_type)
def test_unknown_socket_family_repr(self):
# Test that when created with a family that's not one of the known
# AF_*/SOCK_* constants, socket.family just returns the number.

View File

@@ -178,24 +178,18 @@ class SocketServerTest(unittest.TestCase):
buf += data
self.assertEqual(buf, TEST_STR)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AssertionError: -1 != 18446744073709551615")
def test_TCPServer(self):
self.run_server(socketserver.TCPServer,
socketserver.StreamRequestHandler,
self.stream_examine)
# TODO: RUSTPYTHON, AssertionError: -1 != 18446744073709551615
if os.name == "nt":
test_TCPServer = unittest.expectedFailure(test_TCPServer)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AssertionError: -1 != 18446744073709551615")
def test_ThreadingTCPServer(self):
self.run_server(socketserver.ThreadingTCPServer,
socketserver.StreamRequestHandler,
self.stream_examine)
# TODO: RUSTPYTHON, AssertionError: -1 != 18446744073709551615
if os.name == "nt":
test_ThreadingTCPServer = unittest.expectedFailure(test_ThreadingTCPServer)
@requires_forking
def test_ForkingTCPServer(self):
with simple_subprocess(self):
@@ -223,24 +217,18 @@ class SocketServerTest(unittest.TestCase):
socketserver.StreamRequestHandler,
self.stream_examine)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AssertionError: -1 != 18446744073709551615")
def test_UDPServer(self):
self.run_server(socketserver.UDPServer,
socketserver.DatagramRequestHandler,
self.dgram_examine)
# TODO: RUSTPYTHON, AssertionError: -1 != 18446744073709551615
if os.name == "nt":
test_UDPServer = unittest.expectedFailure(test_UDPServer)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AssertionError: -1 != 18446744073709551615")
def test_ThreadingUDPServer(self):
self.run_server(socketserver.ThreadingUDPServer,
socketserver.DatagramRequestHandler,
self.dgram_examine)
# TODO: RUSTPYTHON, AssertionError: -1 != 18446744073709551615
if os.name == "nt":
test_ThreadingUDPServer = unittest.expectedFailure(test_ThreadingUDPServer)
@requires_forking
def test_ForkingUDPServer(self):
with simple_subprocess(self):
@@ -310,16 +298,13 @@ class SocketServerTest(unittest.TestCase):
socketserver.TCPServer((HOST, -1),
socketserver.StreamRequestHandler)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON; AssertionError: -1 != 18446744073709551615")
def test_context_manager(self):
with socketserver.TCPServer((HOST, 0),
socketserver.StreamRequestHandler) as server:
pass
self.assertEqual(-1, server.socket.fileno())
# TODO: RUSTPYTHON, AssertionError: -1 != 18446744073709551615
if os.name == "nt":
test_context_manager = unittest.expectedFailure(test_context_manager)
class ErrorHandlerTest(unittest.TestCase):
"""Test that the servers pass normal exceptions from the handler to

View File

@@ -185,6 +185,7 @@ class Y1900Tests(unittest.TestCase):
a date before 1900 is passed with a format string containing "%y"
"""
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_y_before_1900(self):
# Issue #13674, #19634
t = (1899, 1, 1, 0, 0, 0, 0, 0, 0)
@@ -195,10 +196,6 @@ class Y1900Tests(unittest.TestCase):
else:
self.assertEqual(time.strftime("%y", t), "99")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_y_before_1900 = unittest.expectedFailure(test_y_before_1900)
def test_y_1900(self):
self.assertEqual(
time.strftime("%y", (1900, 1, 1, 0, 0, 0, 0, 0, 0)), "00")

View File

@@ -936,6 +936,7 @@ class ProcessTestCase(BaseTestCase):
self.assertEqual(stdout, None)
self.assertEqual(stderr, None)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_communicate_pipe_buf(self):
# communicate() with writes larger than pipe_buf
# This test will probably deadlock rather than fail, if
@@ -959,10 +960,6 @@ class ProcessTestCase(BaseTestCase):
(stdout, stderr) = p.communicate(string_to_write)
self.assertEqual(stdout, string_to_write)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_communicate_pipe_buf = unittest.expectedFailure(test_communicate_pipe_buf)
def test_writes_before_communicate(self):
# stdin.write before communicate()
p = subprocess.Popen([sys.executable, "-c",
@@ -1020,6 +1017,7 @@ class ProcessTestCase(BaseTestCase):
self.assertEqual(p.stdout.read(),
"line4\nline5\nline6\nline7\nline8")
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_universal_newlines_communicate(self):
# universal newlines through communicate()
p = subprocess.Popen([sys.executable, "-c",
@@ -1045,10 +1043,6 @@ class ProcessTestCase(BaseTestCase):
self.assertEqual(stdout,
"line2\nline4\nline5\nline6\nline7\nline8")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_universal_newlines_communicate = unittest.expectedFailure(test_universal_newlines_communicate)
def test_universal_newlines_communicate_stdin(self):
# universal newlines through communicate(), with only stdin
p = subprocess.Popen([sys.executable, "-c",
@@ -1075,6 +1069,7 @@ class ProcessTestCase(BaseTestCase):
p.communicate()
self.assertEqual(p.returncode, 0)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_universal_newlines_communicate_stdin_stdout_stderr(self):
# universal newlines through communicate(), with stdin, stdout, stderr
p = subprocess.Popen([sys.executable, "-c",
@@ -1103,10 +1098,6 @@ class ProcessTestCase(BaseTestCase):
# to stderr at exit of subprocess.
self.assertTrue(stderr.startswith("eline2\neline6\neline7\n"))
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_universal_newlines_communicate_stdin_stdout_stderr = unittest.expectedFailure(test_universal_newlines_communicate_stdin_stdout_stderr)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_universal_newlines_communicate_encodings(self):
@@ -1272,16 +1263,13 @@ class ProcessTestCase(BaseTestCase):
self.assertEqual(p.returncode, 0)
self.assertEqual(read_line, expected)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_bufsize_equal_one_text_mode(self):
# line is flushed in text mode with bufsize=1.
# we should get the full line in return
line = "line\n"
self._test_bufsize_equal_one(line, line, universal_newlines=True)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_bufsize_equal_one_text_mode = unittest.expectedFailure(test_bufsize_equal_one_text_mode)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_bufsize_equal_one_binary_mode(self):
@@ -1456,6 +1444,7 @@ class ProcessTestCase(BaseTestCase):
self.assertFalse(os.path.exists(ofname))
self.assertFalse(os.path.exists(efname))
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_communicate_epipe(self):
# Issue 10963: communicate() should hide EPIPE
p = subprocess.Popen(ZERO_RETURN_CMD,
@@ -1467,10 +1456,6 @@ class ProcessTestCase(BaseTestCase):
self.addCleanup(p.stdin.close)
p.communicate(b"x" * 2**20)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_communicate_epipe = unittest.expectedFailure(test_communicate_epipe)
def test_repr(self):
path_cmd = pathlib.Path("my-tool.py")
pathlib_cls = path_cmd.__class__.__name__
@@ -1490,6 +1475,7 @@ class ProcessTestCase(BaseTestCase):
p.returncode = code
self.assertEqual(repr(p), sx)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_communicate_epipe_only_stdin(self):
# Issue 10963: communicate() should hide EPIPE
p = subprocess.Popen(ZERO_RETURN_CMD,
@@ -1498,10 +1484,6 @@ class ProcessTestCase(BaseTestCase):
p.wait()
p.communicate(b"x" * 2**20)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_communicate_epipe_only_stdin = unittest.expectedFailure(test_communicate_epipe_only_stdin)
# TODO: RUSTPYTHON
@unittest.expectedFailure
@unittest.skipUnless(hasattr(signal, 'SIGUSR1'),
@@ -3674,6 +3656,7 @@ class MiscTests(unittest.TestCase):
raise KeyboardInterrupt # Test how __exit__ handles ^C.
self._test_keyboardinterrupt_no_kill(popen_via_context_manager)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_getoutput(self):
self.assertEqual(subprocess.getoutput('echo xyzzy'), 'xyzzy')
self.assertEqual(subprocess.getstatusoutput('echo xyzzy'),
@@ -3707,10 +3690,6 @@ class MiscTests(unittest.TestCase):
possible_exports.add(name)
self.assertEqual(exported, possible_exports - intentionally_excluded)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_getoutput = unittest.expectedFailure(test_getoutput)
@unittest.skipUnless(hasattr(selectors, 'PollSelector'),
"Test needs selectors.PollSelector")

View File

@@ -8,6 +8,7 @@ from test.support import warnings_helper
import unittest
class TestUntestedModules(unittest.TestCase):
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_untested_modules_can_be_imported(self):
untested = ('encodings',)
with warnings_helper.check_warnings(quiet=True):
@@ -53,9 +54,5 @@ class TestUntestedModules(unittest.TestCase):
if support.verbose:
print("skipping tty")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_untested_modules_can_be_imported = unittest.expectedFailure(test_untested_modules_can_be_imported)
if __name__ == "__main__":
unittest.main()

View File

@@ -699,17 +699,13 @@ class TestSupport(unittest.TestCase):
self.check_print_warning("a\nb",
'Warning -- a\nWarning -- b\n')
@unittest.expectedFailureIf(sys.platform != "win32", "TODO: RUSTPYTHON")
def test_has_strftime_extensions(self):
if support.is_emscripten or sys.platform == "win32":
self.assertFalse(support.has_strftime_extensions)
else:
self.assertTrue(support.has_strftime_extensions)
# TODO: RUSTPYTHON
if not sys.platform.startswith("win"):
# TODO: RUSTPYTHON
test_has_strftime_extensions = unittest.expectedFailure(test_has_strftime_extensions)
# XXX -follows a list of untested API
# make_legacy_pyc
# is_resource_enabled

View File

@@ -165,10 +165,7 @@ class TestSysConfig(unittest.TestCase):
sysconfig_includedir = sysconfig.get_path('include', scheme='posix_venv')
self.assertTrue(sysconfig_includedir.startswith(incpath + os.sep))
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_posix_venv_scheme = unittest.expectedFailure(test_posix_venv_scheme)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_nt_venv_scheme(self):
# The following directories were hardcoded in the venv module
# before bpo-45413, here we assert the posix_venv scheme does not regress
@@ -185,10 +182,6 @@ class TestSysConfig(unittest.TestCase):
self.assertEqual(incpath, sysconfig.get_path('include', scheme='nt_venv'))
self.assertEqual(libpath, sysconfig.get_path('purelib', scheme='nt_venv'))
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_nt_venv_scheme = unittest.expectedFailure(test_nt_venv_scheme)
def test_venv_scheme(self):
if sys.platform == 'win32':
self.assertEqual(
@@ -353,6 +346,7 @@ class TestSysConfig(unittest.TestCase):
wanted.extend(['nt_user', 'osx_framework_user', 'posix_user'])
self.assertEqual(get_scheme_names(), tuple(sorted(wanted)))
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
@skip_unless_symlink
@requires_subprocess()
def test_symlink(self): # Issue 7880
@@ -360,10 +354,6 @@ class TestSysConfig(unittest.TestCase):
cmd = "-c", "import sysconfig; print(sysconfig.get_platform())"
self.assertEqual(py.call_real(*cmd), py.call_link(*cmd))
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_symlink = unittest.expectedFailure(test_symlink)
def test_user_similar(self):
# Issue #8759: make sure the posix scheme for the users
# is similar to the global posix_prefix one
@@ -457,6 +447,7 @@ class TestSysConfig(unittest.TestCase):
self.assertEqual(status, 0)
self.assertEqual(my_platform, test_platform)
@unittest.expectedFailureIf(sys.platform != "win32", "TODO: RUSTPYTHON")
@unittest.skipIf(is_wasi, "Incompatible with WASI mapdir and OOT builds")
def test_srcdir(self):
# See Issues #15322, #15364.
@@ -481,10 +472,6 @@ class TestSysConfig(unittest.TestCase):
makefile_dir = os.path.realpath(makefile_dir)
self.assertEqual(makefile_dir, srcdir)
# TODO: RUSTPYTHON
if sys.platform != "win32":
test_srcdir = unittest.expectedFailure(test_srcdir)
def test_srcdir_independent_of_cwd(self):
# srcdir should be independent of the current working directory
# See Issues #15322, #15364.

View File

@@ -626,6 +626,7 @@ class MiscReadTestBase(CommonReadTest):
data = f.read()
self.assertEqual(sha256sum(data), sha256_regtype)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_extractall(self):
# Test if extractall() correctly restores directory permissions
# and times (see issue1735).
@@ -656,10 +657,7 @@ class MiscReadTestBase(CommonReadTest):
tar.close()
os_helper.rmtree(DIR)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_extractall = unittest.expectedFailure(test_extractall)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_extract_directory(self):
dirtype = "ustar/dirtype"
DIR = os.path.join(TEMPDIR, "extractdir")
@@ -675,10 +673,7 @@ class MiscReadTestBase(CommonReadTest):
finally:
os_helper.rmtree(DIR)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_extract_directory = unittest.expectedFailure(test_extract_directory)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_extractall_pathlike_name(self):
DIR = pathlib.Path(TEMPDIR) / "extractall"
with os_helper.temp_dir(DIR), \
@@ -689,10 +684,7 @@ class MiscReadTestBase(CommonReadTest):
path = DIR / tarinfo.name
self.assertEqual(os.path.getmtime(path), tarinfo.mtime)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_extractall_pathlike_name = unittest.expectedFailure(test_extractall_pathlike_name)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_extract_pathlike_name(self):
dirtype = "ustar/dirtype"
DIR = pathlib.Path(TEMPDIR) / "extractall"
@@ -703,10 +695,6 @@ class MiscReadTestBase(CommonReadTest):
extracted = DIR / dirtype
self.assertEqual(os.path.getmtime(extracted), tarinfo.mtime)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_extract_pathlike_name = unittest.expectedFailure(test_extract_pathlike_name)
def test_init_close_fobj(self):
# Issue #7341: Close the internal file object in the TarFile
# constructor in case of an error. For the test we rely on
@@ -1070,34 +1058,22 @@ class GNUReadTest(LongnameTest, ReadTest, unittest.TestCase):
s = os.stat(filename)
self.assertLess(s.st_blocks * 512, s.st_size)
@unittest.expectedFailureIf(sys.platform == "linux", "TODO: RUSTPYTHON")
def test_sparse_file_old(self):
self._test_sparse_file("gnu/sparse")
# TODO: RUSTPYTHON
if sys.platform == "linux":
test_sparse_file_old = unittest.expectedFailure(test_sparse_file_old)
@unittest.expectedFailureIf(sys.platform == "linux", "TODO: RUSTPYTHON")
def test_sparse_file_00(self):
self._test_sparse_file("gnu/sparse-0.0")
# TODO: RUSTPYTHON
if sys.platform == "linux":
test_sparse_file_00 = unittest.expectedFailure(test_sparse_file_00)
@unittest.expectedFailureIf(sys.platform == "linux", "TODO: RUSTPYTHON")
def test_sparse_file_01(self):
self._test_sparse_file("gnu/sparse-0.1")
# TODO: RUSTPYTHON
if sys.platform == "linux":
test_sparse_file_01 = unittest.expectedFailure(test_sparse_file_01)
@unittest.expectedFailureIf(sys.platform == "linux", "TODO: RUSTPYTHON")
def test_sparse_file_10(self):
self._test_sparse_file("gnu/sparse-1.0")
# TODO: RUSTPYTHON
if sys.platform == "linux":
test_sparse_file_10 = unittest.expectedFailure(test_sparse_file_10)
@staticmethod
def _fs_supports_holes():
# Return True if the platform knows the st_blocks stat attribute and
@@ -1298,6 +1274,7 @@ class WriteTest(WriteTestBase, unittest.TestCase):
self.assertEqual(tarinfo.name, tarinfo2.name)
self.assertEqual(tarinfo.size, 3)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
@unittest.skipUnless(hasattr(os, "link"),
"Missing hardlink implementation")
def test_link_size(self):
@@ -1322,10 +1299,6 @@ class WriteTest(WriteTestBase, unittest.TestCase):
os_helper.unlink(target)
os_helper.unlink(link)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_link_size = unittest.expectedFailure(test_link_size)
@os_helper.skip_unless_symlink
def test_symlink_size(self):
path = os.path.join(TEMPDIR, "symlink")
@@ -1880,15 +1853,12 @@ class HardlinkTest(unittest.TestCase):
self.assertEqual(tarinfo.type, tarfile.REGTYPE,
"add file as regular failed")
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_add_hardlink(self):
tarinfo = self.tar.gettarinfo(self.bar)
self.assertEqual(tarinfo.type, tarfile.LNKTYPE,
"add file as hardlink failed")
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_add_hardlink = unittest.expectedFailure(test_add_hardlink)
def test_dereference_hardlink(self):
self.tar.dereference = True
tarinfo = self.tar.gettarinfo(self.bar)

View File

@@ -1417,6 +1417,7 @@ class TestTemporaryDirectory(BaseTestCase):
with open(os.path.join(path, "test%d.txt" % i), "wb") as f:
f.write(b"Hello world!")
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_mkdtemp_failure(self):
# Check no additional exception if mkdtemp fails
# Previously would raise AttributeError instead
@@ -1427,10 +1428,6 @@ class TestTemporaryDirectory(BaseTestCase):
tempfile.TemporaryDirectory(dir=nonexistent)
self.assertEqual(cm.exception.errno, errno.ENOENT)
# TODO: RUSTPYTHON
if sys.platform == "win32":
test_mkdtemp_failure = unittest.expectedFailure(test_mkdtemp_failure)
def test_explicit_cleanup(self):
# A TemporaryDirectory is deleted when cleaned up
dir = tempfile.mkdtemp()

View File

@@ -1237,6 +1237,7 @@ class TestDetectEncoding(TestCase):
found, consumed_lines = detect_encoding(rl)
self.assertEqual(found, "utf-8")
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_short_files(self):
readline = self.get_readline((b'print(something)\n',))
encoding, consumed_lines = detect_encoding(readline)
@@ -1260,11 +1261,6 @@ class TestDetectEncoding(TestCase):
readline = self.get_readline((b'# coding: bad\n',))
self.assertRaises(SyntaxError, detect_encoding, readline)
# TODO: RUSTPYTHON
import sys
if sys.platform == "win32":
test_short_files = unittest.expectedFailure(test_short_files)
def test_false_encoding(self):
# Issue 18873: "Encoding" detected in non-comment lines
readline = self.get_readline((b'print("#coding=fake")',))
@@ -1320,6 +1316,7 @@ class TestDetectEncoding(TestCase):
ins = Bunk(lines, path)
detect_encoding(ins.readline)
@unittest.expectedFailureIfWindows("TODO: RUSTPYTHON")
def test_open_error(self):
# Issue #23840: open() must close the binary file on error
m = BytesIO(b'#coding:xxx')
@@ -1327,11 +1324,6 @@ class TestDetectEncoding(TestCase):
self.assertRaises(SyntaxError, tokenize_open, 'foobar')
self.assertTrue(m.closed)
# TODO: RUSTPYTHON
import sys
if sys.platform == "win32":
test_open_error = unittest.expectedFailure(test_open_error)
class TestTokenize(TestCase):

View File

@@ -102,6 +102,7 @@ class UTF8ModeTests(unittest.TestCase):
self.assertIn('invalid PYTHONUTF8 environment variable value',
out.rstrip())
@unittest.expectedFailureIf(MS_WINDOWS, "TODO: RUSTPYTHON")
def test_filesystemencoding(self):
code = textwrap.dedent('''
import sys
@@ -125,10 +126,6 @@ class UTF8ModeTests(unittest.TestCase):
PYTHONLEGACYWINDOWSFSENCODING='1')
self.assertEqual(out, 'mbcs/replace')
# TODO: RUSTPYTHON
if MS_WINDOWS:
test_filesystemencoding = unittest.expectedFailure(test_filesystemencoding)
# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_stdio(self):
@@ -220,6 +217,7 @@ class UTF8ModeTests(unittest.TestCase):
out = self.get_output('-X', 'utf8', '-c', code, LC_ALL=loc)
self.assertEqual(out, 'utf-8 utf-8')
@unittest.expectedFailureIf(sys.platform.startswith("linux"), "TODO: RUSTPYTHON")
@unittest.skipIf(MS_WINDOWS, 'test specific to Unix')
def test_cmd_line(self):
arg = 'h\xe9\u20ac'.encode('utf-8')
@@ -247,10 +245,6 @@ class UTF8ModeTests(unittest.TestCase):
with self.subTest(LC_ALL=loc):
check('utf8=0', [c_arg], LC_ALL=loc)
# TODO: RUSTPYTHON
if sys.platform == "linux":
test_cmd_line = unittest.expectedFailure(test_cmd_line)
def test_optim_level(self):
# CPython: check that Py_Main() doesn't increment Py_OptimizeFlag
# twice when -X utf8 requires to parse the configuration twice (when

View File

@@ -96,3 +96,19 @@ def __getattr__(name):
from .async_case import IsolatedAsyncioTestCase
return IsolatedAsyncioTestCase
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
# XXX: RUSTPYTHON
# This is very useful to reduce platform difference boilerplates in tests.
def expectedFailureIf(condition, reason):
assert reason.startswith("TODO: RUSTPYTHON")
if condition:
return expectedFailure
else:
return lambda x: x
# XXX: RUSTPYTHON
# Even more useful because most of them are windows only.
def expectedFailureIfWindows(reason):
import sys
return expectedFailureIf(sys.platform == 'win32', reason)