[Git][reproducible-builds/diffoscope][master] 2 commits: Correct "didnt" typo in test utilities.

Chris Lamb gitlab at salsa.debian.org
Thu Oct 25 15:37:18 CEST 2018


Chris Lamb pushed to branch master at Reproducible Builds / diffoscope


Commits:
f5b3a7a3 by Chris Lamb at 2018-10-25T13:17:43Z
Correct "didnt" typo in test utilities.

- - - - -
554c9a20 by Chris Lamb at 2018-10-25T13:36:46Z
Prevent test failures when running under stretch-backports by checking the ocaml version number. (Closes: #911846)

- - - - -


2 changed files:

- tests/comparators/test_ocaml.py
- tests/utils/nonexisting.py


Changes:

=====================================
tests/comparators/test_ocaml.py
=====================================
@@ -18,17 +18,26 @@
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
 import pytest
+import subprocess
 
 from diffoscope.comparators.ocaml import OcamlInterfaceFile
 
 from ..utils.data import load_fixture, get_data
-from ..utils.tools import skip_unless_tools_exist
+from ..utils.tools import skip_unless_tool_is_at_least
 from ..utils.nonexisting import assert_non_existing
 
 cmi1 = load_fixture('test1.cmi')
 cmi2 = load_fixture('test2.cmi')
 
 
+def ocaml_version():
+    try:
+        out = subprocess.check_output(['ocaml', '-version'])
+    except subprocess.CalledProcessError as e:
+        out = e.output
+    return out.decode('utf-8').split()[-1]
+
+
 def test_identification(cmi1):
     assert isinstance(cmi1, OcamlInterfaceFile)
 
@@ -43,12 +52,12 @@ def test_no_differences(cmi1):
     assert difference is None
 
 
- at skip_unless_tools_exist('ocamlobjinfo')
+ at skip_unless_tool_is_at_least('ocamlobjinfo', ocaml_version, '4.05.0')
 def test_diff(differences):
     expected_diff = get_data('ocaml_expected_diff')
     assert differences[0].unified_diff == expected_diff
 
 
- at skip_unless_tools_exist('ocamlobjinfo')
+ at skip_unless_tool_is_at_least('ocamlobjinfo', ocaml_version, '4.05.0')
 def test_compare_non_existing(monkeypatch, cmi1):
     assert_non_existing(monkeypatch, cmi1, has_null_source=False)


=====================================
tests/utils/nonexisting.py
=====================================
@@ -24,7 +24,7 @@ from diffoscope.comparators.missing_file import MissingFile
 
 def assert_non_existing(monkeypatch, fixture, has_null_source=True, has_details=True):
     monkeypatch.setattr(Config(), 'new_file', True)
-    assert Config().new_file, "didnt get patched"
+    assert Config().new_file, "Did not get patched"
 
     difference = fixture.compare(MissingFile('/nonexisting', fixture))
 



View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/5cd1818eff37ea73f58a24de923e2d3f4bba47b0...554c9a20b9904ca27183688b2fc8c5775e9ce9cb

-- 
View it on GitLab: https://salsa.debian.org/reproducible-builds/diffoscope/compare/5cd1818eff37ea73f58a24de923e2d3f4bba47b0...554c9a20b9904ca27183688b2fc8c5775e9ce9cb
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.reproducible-builds.org/pipermail/rb-commits/attachments/20181025/f5e8893e/attachment.html>


More information about the rb-commits mailing list