[diffoscope] 01/01: Add (failing) test for comparing a device with a regular file fails (re. #850055)
Chris Lamb
chris at chris-lamb.co.uk
Tue Jan 31 22:44:10 CET 2017
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch lamby/wip/850055-comparing-device-with-file
in repository diffoscope.
commit c478d1342fca461309451f0799b45b297230cab3
Author: Chris Lamb <lamby at debian.org>
Date: Wed Feb 1 10:43:50 2017 +1300
Add (failing) test for comparing a device with a regular file fails (re. #850055)
Signed-off-by: Chris Lamb <lamby at debian.org>
---
tests/comparators/test_device.py | 53 ++++++++++++++++++++++++++++++++++++++++
tests/data/device_expected_diff | 0
2 files changed, 53 insertions(+)
diff --git a/tests/comparators/test_device.py b/tests/comparators/test_device.py
new file mode 100644
index 0000000..af2ae1c
--- /dev/null
+++ b/tests/comparators/test_device.py
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+#
+# diffoscope: in-depth comparison of files, archives, and directories
+#
+# Copyright © 2017 Chris Lamb <lamby at debian.org>
+#
+# diffoscope is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# diffoscope is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
+
+import pytest
+
+from diffoscope.comparators.binary import FilesystemFile
+from diffoscope.comparators.device import Device
+from diffoscope.comparators.utils.specialize import specialize
+
+from utils.data import load_fixture, data
+
+text_ascii1 = load_fixture('text_ascii1')
+
+ at pytest.fixture
+def devnull():
+ return specialize(FilesystemFile('/dev/null'))
+
+ at pytest.fixture
+def differences(devnull, text_ascii1):
+ return devnull.compare(text_ascii1).details
+
+ at pytest.fixture
+def differences_reverse(devnull, text_ascii1):
+ return text_ascii1.compare(devnull).details
+
+def test_identification(devnull):
+ assert isinstance(devnull, Device)
+
+def test_diff(differences):
+ with open(data('device_expected_diff')) as f:
+ expected_diff = f.read()
+ assert differences[0].unified_diff == expected_diff
+
+def test_diff_reverse(differences_reverse):
+ with open(data('device_expected_diff')) as f:
+ expected_diff = f.read()
+ assert differences[0].unified_diff == expected_diff
diff --git a/tests/data/device_expected_diff b/tests/data/device_expected_diff
new file mode 100644
index 0000000..e69de29
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list