[diffoscope] 05/05: Move diff_ignore_line_numbers to test utilities.

Chris Lamb chris at chris-lamb.co.uk
Tue Dec 27 18:16:32 CET 2016


This is an automated email from the git hooks/post-receive script.

lamby pushed a commit to branch master
in repository diffoscope.

commit 32fb05526dd9a0a94f3574ee9f7ff061a1f0a5dd
Author: Chris Lamb <lamby at debian.org>
Date:   Tue Dec 27 17:10:13 2016 +0000

    Move diff_ignore_line_numbers to test utilities.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>
---
 diffoscope/comparators/utils/__init__.py | 5 -----
 tests/comparators/test_rlib.py           | 4 ++--
 tests/comparators/utils.py               | 6 ++++++
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/diffoscope/comparators/utils/__init__.py b/diffoscope/comparators/utils/__init__.py
index 565f9e1..ef87331 100644
--- a/diffoscope/comparators/utils/__init__.py
+++ b/diffoscope/comparators/utils/__init__.py
@@ -138,11 +138,6 @@ def get_compressed_content_name(path, expected_extension):
     return name
 
 
-DIFF_LINE_NUMBERS_RE = re.compile(r"(^|\n)@@ -(\d+),(\d+) \+(\d+),(\d+) @@(?=\n|$)")
-
-def diff_ignore_line_numbers(diff):
-    return DIFF_LINE_NUMBERS_RE.sub(r"\1@@ -XX,XX +XX,XX @@", diff)
-
 
 NO_COMMENT = None
 
diff --git a/tests/comparators/test_rlib.py b/tests/comparators/test_rlib.py
index 33c1154..93699fc 100644
--- a/tests/comparators/test_rlib.py
+++ b/tests/comparators/test_rlib.py
@@ -22,10 +22,10 @@ import pytest
 import subprocess
 
 from diffoscope.comparators.ar import ArFile
-from diffoscope.comparators.utils import diff_ignore_line_numbers
 
 from utils import skip_unless_tools_exist, skip_unless_tool_is_at_least, \
-    skip_unless_tools_exist, data, load_fixture, assert_non_existing
+    skip_unless_tools_exist, data, load_fixture, assert_non_existing, \
+    diff_ignore_line_numbers
 
 rlib1 = load_fixture(data('test1.rlib'))
 rlib2 = load_fixture(data('test2.rlib'))
diff --git a/tests/comparators/utils.py b/tests/comparators/utils.py
index 818229b..1ffdde3 100644
--- a/tests/comparators/utils.py
+++ b/tests/comparators/utils.py
@@ -18,6 +18,7 @@
 # along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.
 
 import os
+import re
 import pytest
 import diffoscope
 
@@ -74,3 +75,8 @@ def assert_non_existing(monkeypatch, fixture, has_null_source=True, has_details=
     assert difference.source2 == '/nonexisting'
     assert not has_details or len(difference.details) > 0
     assert not has_null_source or difference.details[-1].source2 == '/dev/null'
+
+DIFF_LINE_NUMBERS_RE = re.compile(r"(^|\n)@@ -(\d+),(\d+) \+(\d+),(\d+) @@(?=\n|$)")
+
+def diff_ignore_line_numbers(diff):
+    return DIFF_LINE_NUMBERS_RE.sub(r"\1@@ -XX,XX +XX,XX @@", diff)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git


More information about the diffoscope mailing list