Skip to content
Snippets Groups Projects
Commit 554c9a20 authored by Chris Lamb's avatar Chris Lamb :eyes:
Browse files

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
No related branches found
No related tags found
No related merge requests found
Pipeline #22901 passed
......@@ -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
@skip_unless_tools_exist('ocamlobjinfo')
@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_tools_exist('ocamlobjinfo')
@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)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment