tests: use silenttestrunner in test-simplemerge.py
authorGregory Szorc <gregory.szorc@gmail.com>
Sun, 29 Sep 2019 12:34:52 -0700
changeset 43010 d75142ef054a
parent 43009 e05c141511dd
child 43011 198b51d453fe
tests: use silenttestrunner in test-simplemerge.py The time monkeypatching doesn't appear to work reliably in Python 3, possibly due to unittest using a different time function. This makes the test intermittent due to the execution time not always being `0.00s`. We have our own wrapper around unittest for more deterministic test output. So let's use it. As a bonus, all test output disappeared, so we can remove the .out file! Differential Revision: https://phab.mercurial-scm.org/D6921
tests/test-simplemerge.py
tests/test-simplemerge.py.out
--- a/tests/test-simplemerge.py	Sun Sep 29 12:25:29 2019 -0700
+++ b/tests/test-simplemerge.py	Sun Sep 29 12:34:52 2019 -0700
@@ -355,11 +355,5 @@
                          b'>>>>>>> THIS\r'.splitlines(True), list(m_lines))
 
 if __name__ == '__main__':
-    # hide the timer
-    import time
-    orig = time.time
-    try:
-        time.time = lambda: 0
-        unittest.main()
-    finally:
-        time.time = orig
+    import silenttestrunner
+    silenttestrunner.main(__name__)
--- a/tests/test-simplemerge.py.out	Sun Sep 29 12:25:29 2019 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-................
-----------------------------------------------------------------------
-Ran 16 tests in 0.000s
-
-OK