D6921: tests: use silenttestrunner in test-simplemerge.py

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sun Sep 29 19:35:14 UTC 2019


indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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!

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6921

AFFECTED FILES
  tests/test-simplemerge.py
  tests/test-simplemerge.py.out

CHANGE DETAILS

diff --git a/tests/test-simplemerge.py.out b/tests/test-simplemerge.py.out
deleted file mode 100644
--- a/tests/test-simplemerge.py.out
+++ /dev/null
@@ -1,5 +0,0 @@
-................
-----------------------------------------------------------------------
-Ran 16 tests in 0.000s
-
-OK
diff --git a/tests/test-simplemerge.py b/tests/test-simplemerge.py
--- a/tests/test-simplemerge.py
+++ b/tests/test-simplemerge.py
@@ -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__)



To: indygreg, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list