https://github.com/python/cpython/commit/d7e83398c188a0acd19a496ee2eeeeab52d64a11
commit: d7e83398c188a0acd19a496ee2eeeeab52d64a11
branch: main
author: sobolevn <[email protected]>
committer: encukou <[email protected]>
date: 2024-09-13T13:13:52+02:00
summary:

gh-108303: Remove the non-test `Lib/test/reperf.py` (GH-114356)

files:
D Lib/test/reperf.py
M Lib/test/_test_embed_structseq.py
M Lib/test/test_embed.py

diff --git a/Lib/test/_test_embed_structseq.py 
b/Lib/test/_test_embed_structseq.py
index 868f9f83e8be77..154662efce9412 100644
--- a/Lib/test/_test_embed_structseq.py
+++ b/Lib/test/_test_embed_structseq.py
@@ -48,7 +48,14 @@ def test_sys_funcs(self):
 
 
 try:
-    unittest.main()
+    unittest.main(
+        module=(
+            '__main__'
+            if __name__ == '__main__'
+            # Avoiding a circular import:
+            else sys.modules['test._test_embed_structseq']
+        )
+    )
 except SystemExit as exc:
     if exc.args[0] != 0:
         raise
diff --git a/Lib/test/reperf.py b/Lib/test/reperf.py
deleted file mode 100644
index e93bacdb5843c6..00000000000000
--- a/Lib/test/reperf.py
+++ /dev/null
@@ -1,23 +0,0 @@
-import re
-import time
-
-def main():
-    s = "\13hello\14 \13world\14 " * 1000
-    p = re.compile(r"([\13\14])")
-    timefunc(10, p.sub, "", s)
-    timefunc(10, p.split, s)
-    timefunc(10, p.findall, s)
-
-def timefunc(n, func, *args, **kw):
-    t0 = time.perf_counter()
-    try:
-        for i in range(n):
-            result = func(*args, **kw)
-        return result
-    finally:
-        t1 = time.perf_counter()
-        if n > 1:
-            print(n, "times", end=' ')
-        print(func.__name__, "%.3f" % (t1-t0), "CPU seconds")
-
-main()
diff --git a/Lib/test/test_embed.py b/Lib/test/test_embed.py
index 6790326a2afa47..7c5cb855a397ab 100644
--- a/Lib/test/test_embed.py
+++ b/Lib/test/test_embed.py
@@ -1971,7 +1971,11 @@ def test_no_memleak(self):
     @unittest.skipUnless(support.Py_DEBUG,
                          '-X presite requires a Python debug build')
     def test_presite(self):
-        cmd = [sys.executable, "-I", "-X", "presite=test.reperf", "-c", 
"print('cmd')"]
+        cmd = [
+            sys.executable,
+            "-I", "-X", "presite=test._test_embed_structseq",
+            "-c", "print('unique-python-message')",
+        ]
         proc = subprocess.run(
             cmd,
             stdout=subprocess.PIPE,
@@ -1980,9 +1984,8 @@ def test_presite(self):
         )
         self.assertEqual(proc.returncode, 0)
         out = proc.stdout.strip()
-        self.assertIn("10 times sub", out)
-        self.assertIn("CPU seconds", out)
-        self.assertIn("cmd", out)
+        self.assertIn("Tests passed", out)
+        self.assertIn("unique-python-message", out)
 
 
 class StdPrinterTests(EmbeddingTestsMixin, unittest.TestCase):

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to