Verified Commit ef5ae496 authored by Mattia Rizzolo's avatar Mattia Rizzolo

Adapt tests to the output of gnumeric 1.12.43

Signed-off-by: Mattia Rizzolo's avatarMattia Rizzolo <mattia@debian.org>
parent 89e7e67e
Pipeline #20231 failed with stage
in 3 minutes and 35 seconds
......@@ -18,17 +18,27 @@
# along with diffoscope. If not, see <https://www.gnu.org/licenses/>.
import pytest
import subprocess
from diffoscope.comparators.gnumeric import GnumericFile
from ..utils.data import load_fixture, get_data
from ..utils.tools import skip_unless_tools_exist
from ..utils.nonexisting import assert_non_existing
from ..utils.tools import (
skip_unless_tools_exist,
skip_unless_tool_is_at_least,
skip_unless_tool_is_at_most,
)
gnumeric1 = load_fixture('test1.gnumeric')
gnumeric2 = load_fixture('test2.gnumeric')
def ssconvert_version():
out = subprocess.check_output(('ssconvert', '--version'))
return out.decode('utf-8').split()[2].replace("'", '')
def test_identification(gnumeric1):
assert isinstance(gnumeric1, GnumericFile)
......@@ -43,12 +53,19 @@ def differences(gnumeric1, gnumeric2):
return gnumeric1.compare(gnumeric2).details
@skip_unless_tools_exist('ssconvert')
def test_diff(differences):
expected_diff = get_data('gnumeric_expected_diff')
@skip_unless_tool_is_at_most('ssconvert', ssconvert_version, '1.12.42')
def test_diff_old(differences):
expected_diff = get_data('gnumeric_1.12.42_expected_diff')
assert differences[0].unified_diff == expected_diff
@skip_unless_tool_is_at_least('ssconvert', ssconvert_version, '1.12.43')
def test_diff_new(differences):
expected_diff = get_data('gnumeric_1.12.43_expected_diff')
assert differences[0].unified_diff == expected_diff
@skip_unless_tools_exist('ssconvert')
def test_compare_non_existing(monkeypatch, gnumeric1):
assert_non_existing(monkeypatch, gnumeric1, has_null_source=False)
  • that URL 404s for me…?

    (and also locally it gives unknown commit e9d3062)

  • Oh, race condition… 255cbe59

  • Ah, I see what you meant there. But that wouldn't have been enough, as also the values in the diff headers are different (i.e. @@ -1 +1 @@ vs @@ -1,3 +1,3 @@)

  • but now, doesn't adding that .strip() make the new test of mine fail?

  • It does. Reverted it in 344ae4d6.

    (The .strip() /when I wrote it/ did cause the test to succeed as planned, but perhaps I didn't think about those diff headers which were not changing for me... the strip surely occurrs before diff is called anyway?)

  • Oh right. I think I was thinking of me while I was looking at fixing it, I did try to add a diff, but I must have placed it somewhere different (clearly after diff was called…)

    Anyway, if you think your fix is better, do feel free to revert my change and add yours!

  • mentioned in commit 47588095

    Toggle commit list
  • Done in 47588095. Again, sorry about the mess...

  • Instead, thank you for solving the issue in a much smaller (!) commit than mine!

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