Commit 554c9a20 authored by Chris Lamb's avatar Chris Lamb 💬

Prevent test failures when running under stretch-backports by checking the...

Prevent test failures when running under stretch-backports by checking the ocaml version number. (Closes: #911846)
parent f5b3a7a3
Pipeline #22901 passed with stage
in 11 minutes and 53 seconds
......@@ -18,17 +18,26 @@
# along with diffoscope. If not, see <>.
import pytest
import subprocess
from diffoscope.comparators.ocaml import OcamlInterfaceFile
from import load_fixture, get_data
from import skip_unless_tools_exist
from 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():
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
@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
@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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment