@@ -60,6 +60,7 @@ def raise_catch(self, exc, excname):
60
60
self .assertEqual (buf1 , buf2 )
61
61
self .assertEqual (exc .__name__ , excname )
62
62
63
+ @support .thread_unsafe ("TESTFN" )
63
64
def testRaising (self ):
64
65
self .raise_catch (AttributeError , "AttributeError" )
65
66
self .assertRaises (AttributeError , getattr , sys , "undefined_attribute" )
@@ -1361,6 +1362,7 @@ def test_unicode_error_str_does_not_crash(self):
1361
1362
self .assertIsInstance (str (exc ), str )
1362
1363
1363
1364
@no_tracing
1365
+ @support .thread_unsafe ("captures stderr" )
1364
1366
def test_badisinstance (self ):
1365
1367
# Bug #2542: if issubclass(e, MyException) raises an exception,
1366
1368
# it should be ignored
@@ -1484,6 +1486,7 @@ def test_recursion_normalizing_infinite_exception(self):
1484
1486
self .assertIn (b'Done.' , out )
1485
1487
1486
1488
1489
+ @support .thread_unsafe ("uses sys.setrecursionlimit" )
1487
1490
def test_recursion_in_except_handler (self ):
1488
1491
1489
1492
def set_relative_recursion_limit (n ):
@@ -1619,6 +1622,7 @@ class C(object):
1619
1622
1620
1623
@cpython_only
1621
1624
@unittest .skipIf (_testcapi is None , "requires _testcapi" )
1625
+ @support .thread_unsafe ("gc_collect()" )
1622
1626
def test_memory_error_cleanup (self ):
1623
1627
# Issue #5437: preallocated MemoryError instances should not keep
1624
1628
# traceback objects alive.
@@ -1668,6 +1672,7 @@ def test_errno_ENOTDIR(self):
1668
1672
os .listdir (__file__ )
1669
1673
self .assertEqual (cm .exception .errno , errno .ENOTDIR , cm .exception )
1670
1674
1675
+ @support .thread_unsafe ("uses catch_unraisable_exception" )
1671
1676
def test_unraisable (self ):
1672
1677
# Issue #22836: PyErr_WriteUnraisable() should give sensible reports
1673
1678
class BrokenDel :
@@ -1687,6 +1692,7 @@ def __del__(self):
1687
1692
f"deallocator { obj_repr } " )
1688
1693
self .assertIsNotNone (cm .unraisable .exc_traceback )
1689
1694
1695
+ @support .thread_unsafe ("captures stderr" )
1690
1696
def test_unhandled (self ):
1691
1697
# Check for sensible reporting of unhandled exceptions
1692
1698
for exc_type in (ValueError , BrokenStrException ):
@@ -1786,6 +1792,7 @@ def g():
1786
1792
next (i )
1787
1793
1788
1794
@unittest .skipUnless (__debug__ , "Won't work if __debug__ is False" )
1795
+ @support .thread_unsafe ("modifies global AssertionError" )
1789
1796
def test_assert_shadowing (self ):
1790
1797
# Shadowing AssertionError would cause the assert statement to
1791
1798
# misbehave.
@@ -1877,6 +1884,7 @@ def test_name_error_has_name(self):
1877
1884
except NameError as exc :
1878
1885
self .assertEqual ("bluch" , exc .name )
1879
1886
1887
+ @support .thread_unsafe ("captures stderr" )
1880
1888
def test_issue45826 (self ):
1881
1889
# regression test for bpo-45826
1882
1890
def f ():
@@ -1893,6 +1901,7 @@ def f():
1893
1901
1894
1902
self .assertIn ("aab" , err .getvalue ())
1895
1903
1904
+ @support .thread_unsafe ("captures stderr" )
1896
1905
def test_issue45826_focused (self ):
1897
1906
def f ():
1898
1907
try :
@@ -2295,6 +2304,7 @@ class MySyntaxError(SyntaxError):
2295
2304
^^^^^
2296
2305
""" , err .getvalue ())
2297
2306
2307
+ @support .thread_unsafe ("TESTFN" )
2298
2308
def test_encodings (self ):
2299
2309
self .addCleanup (unlink , TESTFN )
2300
2310
source = (
0 commit comments