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

login
register
mail settings
Submitter phabricator
Date Sept. 29, 2019, 7:35 p.m.
Message ID <differential-rev-PHID-DREV-pn6mcnpp3ibzurqptkbv-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41845/
State Superseded
Headers show

Comments

phabricator - Sept. 29, 2019, 7:35 p.m.
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




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

Patch

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__)