mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
Update warnings from v3.14.2
Assisted-by: Codex:gpt-6
This commit is contained in:
1 parent
57496bb9d7
commit
b5edbd0ca7
1 file changed
+35
-35
Vendored
+35
-35
@@ -565,7 +565,7 @@ class WarnTests(BaseTest):
|
||||
self.assertEqual(os.path.basename(w[-1].filename),
|
||||
"<sys>")
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; + crates/pylib/Lib/test/test_warnings/__init__.py
|
||||
def test_stacklevel_import(self):
|
||||
# Issue #24305: With stacklevel=2, module-level warnings should work.
|
||||
import_helper.unload('test.test_warnings.data.import_warning')
|
||||
@@ -807,43 +807,43 @@ class CWarnTests(WarnTests, unittest.TestCase):
|
||||
|
||||
# As an early adopter, we sanity check the
|
||||
# test.import_helper.import_fresh_module utility function
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 'function' object has unexpected attribute '__code__'
|
||||
def test_accelerated(self):
|
||||
self.assertIsNot(original_warnings, self.module)
|
||||
self.assertNotHasAttr(self.module.warn, '__code__')
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 1 != 2
|
||||
def test_gh86298_loader_and_spec_loader_disagree(self):
|
||||
return super().test_gh86298_loader_and_spec_loader_disagree()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
def test_gh86298_loader_is_none_and_spec_is_none(self):
|
||||
return super().test_gh86298_loader_is_none_and_spec_is_none()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
def test_gh86298_loader_is_none_and_spec_loader_is_none(self):
|
||||
return super().test_gh86298_loader_is_none_and_spec_loader_is_none()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
def test_gh86298_no_loader_and_no_spec_loader(self):
|
||||
return super().test_gh86298_no_loader_and_no_spec_loader()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
def test_gh86298_no_loader_and_spec_is_none(self):
|
||||
return super().test_gh86298_no_loader_and_spec_is_none()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 1 != 2
|
||||
def test_gh86298_no_spec(self):
|
||||
return super().test_gh86298_no_spec()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 1 != 2
|
||||
def test_gh86298_no_spec_loader(self):
|
||||
return super().test_gh86298_no_spec_loader()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: 1 != 2
|
||||
def test_gh86298_spec_is_none(self):
|
||||
return super().test_gh86298_spec_is_none()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: AttributeError not raised
|
||||
def test_gh86298_no_loader_and_no_spec_loader(self):
|
||||
return super().test_gh86298_no_loader_and_no_spec_loader()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: ValueError not raised
|
||||
def test_gh86298_loader_is_none_and_spec_is_none(self):
|
||||
return super().test_gh86298_loader_is_none_and_spec_is_none()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: ValueError not raised
|
||||
def test_gh86298_loader_is_none_and_spec_loader_is_none(self):
|
||||
return super().test_gh86298_loader_is_none_and_spec_loader_is_none()
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: ValueError not raised
|
||||
def test_gh86298_no_loader_and_spec_is_none(self):
|
||||
return super().test_gh86298_no_loader_and_spec_is_none()
|
||||
|
||||
class PyWarnTests(WarnTests, unittest.TestCase):
|
||||
module = py_warnings
|
||||
|
||||
@@ -919,7 +919,7 @@ class _WarningsTests(BaseTest, unittest.TestCase):
|
||||
|
||||
module = c_warnings
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: UserWarning not raised by warn
|
||||
def test_filter(self):
|
||||
# Everything should function even if 'filters' is not in warnings.
|
||||
with self.module.catch_warnings() as w:
|
||||
@@ -930,7 +930,7 @@ class _WarningsTests(BaseTest, unittest.TestCase):
|
||||
self.assertRaises(UserWarning, self.module.warn,
|
||||
'convert to error')
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'warnings' has no attribute 'onceregistry'
|
||||
def test_onceregistry(self):
|
||||
# Replacing or removing the onceregistry should be okay.
|
||||
global __warningregistry__
|
||||
@@ -960,7 +960,7 @@ class _WarningsTests(BaseTest, unittest.TestCase):
|
||||
finally:
|
||||
self.module.onceregistry = original_registry
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'warnings' has no attribute 'defaultaction'
|
||||
def test_default_action(self):
|
||||
# Replacing or removing defaultaction should be okay.
|
||||
message = UserWarning("defaultaction test")
|
||||
@@ -1012,7 +1012,7 @@ class _WarningsTests(BaseTest, unittest.TestCase):
|
||||
result = stream.getvalue()
|
||||
self.assertIn(text, result)
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AttributeError: module 'warnings' has no attribute '_showwarnmsg'. Did you mean: 'showwarning'?
|
||||
def test_showwarnmsg_missing(self):
|
||||
# Test that _showwarnmsg() missing is okay.
|
||||
text = 'del _showwarnmsg test'
|
||||
@@ -1092,7 +1092,7 @@ class _WarningsTests(BaseTest, unittest.TestCase):
|
||||
self.assertNotIn(b'Warning!', stderr)
|
||||
self.assertNotIn(b'Error', stderr)
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; TypeError: 'int' object is not iterable
|
||||
def test_issue31285(self):
|
||||
# warn_explicit() should neither raise a SystemError nor cause an
|
||||
# assertion failure, in case the return value of get_source() has a
|
||||
@@ -1245,7 +1245,7 @@ class CWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase):
|
||||
class PyWarningsDisplayTests(WarningsDisplayTests, unittest.TestCase):
|
||||
module = py_warnings
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; + ResourceWarning: Enable tracemalloc to get the object allocation traceback
|
||||
def test_tracemalloc(self):
|
||||
self.addCleanup(os_helper.unlink, os_helper.TESTFN)
|
||||
|
||||
@@ -1458,7 +1458,7 @@ class PyCatchWarningTests(CatchWarningTests, unittest.TestCase):
|
||||
|
||||
class EnvironmentVariableTests(BaseTest):
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: b'[]' != b"['ignore::DeprecationWarning']"
|
||||
def test_single_warning(self):
|
||||
rc, stdout, stderr = assert_python_ok("-c",
|
||||
"import sys; sys.stdout.write(str(sys.warnoptions))",
|
||||
@@ -1466,7 +1466,7 @@ class EnvironmentVariableTests(BaseTest):
|
||||
PYTHONDEVMODE="")
|
||||
self.assertEqual(stdout, b"['ignore::DeprecationWarning']")
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: b'[]' != b"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']"
|
||||
def test_comma_separated_warnings(self):
|
||||
rc, stdout, stderr = assert_python_ok("-c",
|
||||
"import sys; sys.stdout.write(str(sys.warnoptions))",
|
||||
@@ -1475,7 +1475,7 @@ class EnvironmentVariableTests(BaseTest):
|
||||
self.assertEqual(stdout,
|
||||
b"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']")
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: b"['ignore::UnicodeWarning']" != b"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']"
|
||||
@force_not_colorized
|
||||
def test_envvar_and_command_line(self):
|
||||
rc, stdout, stderr = assert_python_ok("-Wignore::UnicodeWarning", "-c",
|
||||
@@ -1485,7 +1485,7 @@ class EnvironmentVariableTests(BaseTest):
|
||||
self.assertEqual(stdout,
|
||||
b"['ignore::DeprecationWarning', 'ignore::UnicodeWarning']")
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: b"['error::DeprecationWarning']" != b"['default::DeprecationWarning', 'error::DeprecationWarning']"
|
||||
@force_not_colorized
|
||||
def test_conflicting_envvar_and_command_line(self):
|
||||
rc, stdout, stderr = assert_python_failure("-Werror::DeprecationWarning", "-c",
|
||||
@@ -1535,7 +1535,7 @@ class EnvironmentVariableTests(BaseTest):
|
||||
self.assertEqual(stdout_lines, expected_output)
|
||||
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: b'[]' != b"['ignore:DeprecationWarning\xc3\xa6']"
|
||||
@unittest.skipUnless(sys.getfilesystemencoding() != 'ascii',
|
||||
'requires non-ascii filesystemencoding')
|
||||
def test_nonascii(self):
|
||||
@@ -1623,7 +1623,7 @@ class BootstrapTest(unittest.TestCase):
|
||||
|
||||
|
||||
class FinalizationTest(unittest.TestCase):
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; - TypeError: 'NoneType' object is not callable
|
||||
def test_finalization(self):
|
||||
# Issue #19421: warnings.warn() should not crash
|
||||
# during Python finalization
|
||||
@@ -1641,7 +1641,7 @@ a=A()
|
||||
self.assertEqual(err.decode().rstrip(),
|
||||
'<string>:7: UserWarning: test')
|
||||
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON
|
||||
@unittest.expectedFailure # TODO: RUSTPYTHON; AssertionError: b'' doesn't start with b'<sys>:0: ResourceWarning: unclosed file '
|
||||
def test_late_resource_warning(self):
|
||||
# Issue #21925: Emitting a ResourceWarning late during the Python
|
||||
# shutdown must be logged.
|
||||
|
||||
Reference in new issue
Block a user