[diffoscope] 01/01: tests: When comparing two empty directories, ensure that the mtime of the directory is consistent to avoid non-deterministic failures.

Chris Lamb chris at chris-lamb.co.uk
Thu Feb 2 05:01:34 CET 2017


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit d58051b401287a8af3e811b99eb69bd366831645
Author: Chris Lamb <lamby at debian.org>
Date:   Thu Feb 2 17:00:33 2017 +1300

    tests: When comparing two empty directories, ensure that the mtime of the directory is consistent to avoid non-deterministic failures.
---
 tests/test_main.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/test_main.py b/tests/test_main.py
index f81bd34..026bce5 100644
--- a/tests/test_main.py
+++ b/tests/test_main.py
@@ -106,7 +106,12 @@ def test_no_differences(capsys):
     assert out == ''
 
 def test_no_differences_directories(capsys, tmpdir):
-    ret, out, err = run(capsys, str(tmpdir.mkdir('a')), str(tmpdir.mkdir('b')))
+    def create_dir(x):
+        path = str(tmpdir.mkdir(x))
+        os.utime(path, (0, 0)) # Ensure consistent mtime
+        return path
+
+    ret, out, err = run(capsys, create_dir('a'), create_dir('b'))
 
     assert ret == 0
     assert err == ''

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list