84c534e
diff -r e245b0d7209b Lib/test/test_gc.py
84c534e
--- a/Lib/test/test_gc.py	Sun Oct 20 02:01:29 2013 -0700
84c534e
+++ b/Lib/test/test_gc.py	Fri Nov 08 13:25:29 2013 +0100
84c534e
@@ -127,10 +127,16 @@
84c534e
         del a
84c534e
         self.assertNotEqual(gc.collect(), 0)
84c534e
         del B, C
84c534e
-        self.assertNotEqual(gc.collect(), 0)
84c534e
+        if hasattr(sys, 'getcounts'):
84c534e
+            self.assertEqual(gc.collect(), 0)
84c534e
+        else:
84c534e
+            self.assertNotEqual(gc.collect(), 0)
84c534e
         A.a = A()
84c534e
         del A
84c534e
-        self.assertNotEqual(gc.collect(), 0)
84c534e
+        if hasattr(sys, 'getcounts'):
84c534e
+            self.assertEqual(gc.collect(), 0)
84c534e
+        else:
84c534e
+            self.assertNotEqual(gc.collect(), 0)
84c534e
         self.assertEqual(gc.collect(), 0)
84c534e
 
84c534e
     def test_method(self):
84c534e
@@ -618,6 +624,8 @@
84c534e
         stderr = run_command(code % "gc.DEBUG_SAVEALL")
84c534e
         self.assertNotIn(b"uncollectable objects at shutdown", stderr)
84c534e
 
84c534e
+    @unittest.skipIf(hasattr(sys, 'getcounts'),
84c534e
+                     'types are immortal if COUNT_ALLOCS is used')
84c534e
     def test_gc_main_module_at_shutdown(self):
84c534e
         # Create a reference cycle through the __main__ module and check
84c534e
         # it gets collected at interpreter shutdown.
84c534e
@@ -632,6 +640,8 @@
84c534e
         rc, out, err = assert_python_ok('-c', code)
84c534e
         self.assertEqual(out.strip(), b'__del__ called')
84c534e
 
84c534e
+    @unittest.skipIf(hasattr(sys, 'getcounts'),
84c534e
+                     'types are immortal if COUNT_ALLOCS is used')
84c534e
     def test_gc_ordinary_module_at_shutdown(self):
84c534e
         # Same as above, but with a non-__main__ module.
84c534e
         with temp_dir() as script_dir:
84c534e
diff -r e245b0d7209b Lib/test/test_module.py
84c534e
--- a/Lib/test/test_module.py	Sun Oct 20 02:01:29 2013 -0700
84c534e
+++ b/Lib/test/test_module.py	Fri Nov 08 13:25:29 2013 +0100
84c534e
@@ -81,6 +81,8 @@
84c534e
         gc_collect()
84c534e
         self.assertEqual(f().__dict__["bar"], 4)
84c534e
 
84c534e
+    @unittest.skipIf(hasattr(sys, 'getcounts'), 
84c534e
+                     'types are immortal if COUNT_ALLOCS is used')
84c534e
     def test_clear_dict_in_ref_cycle(self):
84c534e
         destroyed = []
84c534e
         m = ModuleType("foo")
84c534e
@@ -96,6 +98,8 @@
84c534e
         gc_collect()
84c534e
         self.assertEqual(destroyed, [1])
84c534e
 
84c534e
+    @unittest.skipIf(hasattr(sys, 'getcounts'), 
84c534e
+                     'types are immortal if COUNT_ALLOCS is used')
84c534e
     def test_weakref(self):
84c534e
         m = ModuleType("foo")
84c534e
         wr = weakref.ref(m)
84c534e
@@ -190,6 +194,8 @@
bf35167
         self.assertEqual(r[-len(ends_with):], ends_with,
bf35167
                          '{!r} does not end with {!r}'.format(r, ends_with))
84c534e
 
84c534e
+    @unittest.skipIf(hasattr(sys, 'getcounts'),
84c534e
+                     'skipping since COUNT_ALLOCS was used, see issue19527')
84c534e
     def test_module_finalization_at_shutdown(self):
84c534e
         # Module globals and builtins should still be available during shutdown
84c534e
         rc, out, err = assert_python_ok("-c", "from test import final_a")
db2025e
--- a/Lib/test/test_io.py.orig	2014-01-09 14:43:44.000000000 +0100
db2025e
+++ b/Lib/test/test_io.py	2014-01-09 14:50:30.839597351 +0100
db2025e
@@ -2611,6 +2611,8 @@
db2025e
             """.format(iomod=iomod, kwargs=kwargs)
db2025e
         return assert_python_ok("-c", code)
db2025e
 
db2025e
+    @unittest.skipIf(hasattr(sys, 'getrefcount'),
db2025e
+                     'types are immortal if COUNT_ALLOCS is used')
db2025e
     def test_create_at_shutdown_without_encoding(self):
db2025e
         rc, out, err = self._check_create_at_shutdown()
db2025e
         if err:
db2025e
@@ -2621,6 +2623,8 @@
db2025e
         else:
db2025e
             self.assertEqual("ok", out.decode().strip())
db2025e
 
db2025e
+    @unittest.skipIf(hasattr(sys, 'getrefcount'),
db2025e
+                     'types are immortal if COUNT_ALLOCS is used')
db2025e
     def test_create_at_shutdown_with_encoding(self):
db2025e
         rc, out, err = self._check_create_at_shutdown(encoding='utf-8',
db2025e
                                                       errors='strict')
db2025e
--- a/Lib/test/test_logging.py.orig	2014-01-09 14:53:07.016388198 +0100
db2025e
+++ b/Lib/test/test_logging.py	2014-01-09 14:54:25.654282973 +0100
db2025e
@@ -3398,6 +3398,8 @@
db2025e
         logging.setLoggerClass(logging.Logger)
db2025e
         self.assertEqual(logging.getLoggerClass(), logging.Logger)
db2025e
 
db2025e
+    @unittest.skipIf(hasattr(sys, 'getcounts'),
db2025e
+                     'types are immortal if COUNT_ALLOCS is used')
db2025e
     def test_logging_at_shutdown(self):
db2025e
         # Issue #20037
db2025e
         code = """if 1:
Matej Stuchlik e9b7bf0
Matej Stuchlik e9b7bf0
--- a/Lib/test/test_warnings.py.orig   2014-01-09 15:10:12.454997100 +0100
Matej Stuchlik e9b7bf0
+++ b/Lib/test/test_warnings.py    2014-01-09 15:11:14.028913478 +0100
Matej Stuchlik e9b7bf0
@@ -780,6 +780,8 @@
Matej Stuchlik e9b7bf0
             assert_python_ok('-c', 'pass', '-W', 'always', PYTHONPATH=cwd)
db2025e
 
db2025e
 class FinalizationTest(unittest.TestCase):
db2025e
+    @unittest.skipIf(hasattr(sys, 'getcounts'),
db2025e
+                     'types are immortal if COUNT_ALLOCS is used')
db2025e
     def test_finalization(self):
db2025e
         # Issue #19421: warnings.warn() should not crash
db2025e
         # during Python finalization