[diffoscope] 01/01: tests/test_git: Fix test failure on FreeBSD

Mattia Rizzolo mattia at debian.org
Thu May 10 17:44:34 CEST 2018


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

mattia pushed a commit to branch master
in repository diffoscope.

commit dcac3508f37f7e87fc89a552449b66c3a32496c5
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Thu May 10 17:43:43 2018 +0200

    tests/test_git: Fix test failure on FreeBSD
    
    Closes: #872826
    Thanks: Ximin Luo <infinity0 at debian.org> for the initial patch
    Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
 tests/comparators/test_git.py        |  6 +++++-
 tests/data/git_expected_diff_freebsd | 19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/tests/comparators/test_git.py b/tests/comparators/test_git.py
index dd0c02a..781f97f 100644
--- a/tests/comparators/test_git.py
+++ b/tests/comparators/test_git.py
@@ -19,6 +19,7 @@
 
 import pytest
 
+from diffoscope.tools import get_current_os
 from diffoscope.comparators.git import GitIndexFile
 
 from ..utils.data import get_data, load_fixture
@@ -42,5 +43,8 @@ def differences(git1, git2):
 
 
 def test_diff(differences):
-    expected_diff = get_data('git_expected_diff')
+    if get_current_os == 'FreeBSD':
+        expected_diff = get_data('git_expected_diff_freebsd')
+    else:
+        expected_diff = get_data('git_expected_diff')
     assert differences[0].unified_diff == expected_diff
diff --git a/tests/data/git_expected_diff_freebsd b/tests/data/git_expected_diff_freebsd
new file mode 100644
index 0000000..f357a2d
--- /dev/null
+++ b/tests/data/git_expected_diff_freebsd
@@ -0,0 +1,19 @@
+@@ -10,7 +10,18 @@
+ User ID:   1000
+ Group ID:  1000
+ Created:   1471689380.154572964
+ Modified:  1471689380.154572964
+ Inode:     52205983
+ Device ID: (0, 2054)
+ 
++Path:      b'b'
++SHA:       e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
++Size:      0
++Flags:     0b1
++User ID:   1000
++Group ID:  1000
++Created:   1471689417.184218147
++Modified:  1471689417.184218147
++Inode:     52206041
++Device ID: (0, 2054)
++

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


More information about the rb-commits mailing list