[diffoscope] 02/05: Use the path attribute of the specialized file instead of the original name

Mattia Rizzolo mattia at debian.org
Mon Jan 16 10:47:10 CET 2017


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

mattia pushed a commit to branch wip/tests-dry
in repository diffoscope.

commit 83d0886b7a32085e1d13cce5fafb8effebe956eb
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Sun Jan 15 20:43:54 2017 +0100

    Use the path attribute of the specialized file instead of the original name
---
 tests/comparators/test_bzip2.py | 6 +++---
 tests/comparators/test_gzip.py  | 6 +++---
 tests/comparators/test_xz.py    | 6 +++---
 tests/comparators/test_zip.py   | 6 +++---
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tests/comparators/test_bzip2.py b/tests/comparators/test_bzip2.py
index e749b4e..9bf332e 100644
--- a/tests/comparators/test_bzip2.py
+++ b/tests/comparators/test_bzip2.py
@@ -52,11 +52,11 @@ def test_content_source(differences):
     assert differences[0].source2 == 'test2'
 
 @skip_unless_tools_exist('bzip2')
-def test_content_source_without_extension(tmpdir):
+def test_content_source_without_extension(tmpdir, bzip1, bzip2):
     path1 = str(tmpdir.join('test1'))
     path2 = str(tmpdir.join('test2'))
-    shutil.copy(TEST_FILE1_PATH, path1)
-    shutil.copy(TEST_FILE2_PATH, path2)
+    shutil.copy(bzip1.path, path1)
+    shutil.copy(bzip2.path, path2)
     bzip1 = specialize(FilesystemFile(path1))
     bzip2 = specialize(FilesystemFile(path2))
     differences = bzip1.compare(bzip2).details
diff --git a/tests/comparators/test_gzip.py b/tests/comparators/test_gzip.py
index b14d2a6..97a7a21 100644
--- a/tests/comparators/test_gzip.py
+++ b/tests/comparators/test_gzip.py
@@ -57,11 +57,11 @@ def test_content_source(differences):
     assert differences[1].source1 == 'test1'
     assert differences[1].source2 == 'test2'
 
-def test_content_source_without_extension(tmpdir):
+def test_content_source_without_extension(tmpdir, gzip1, gzip2):
     path1 = str(tmpdir.join('test1'))
     path2 = str(tmpdir.join('test2'))
-    shutil.copy(TEST_FILE1_PATH, path1)
-    shutil.copy(TEST_FILE2_PATH, path2)
+    shutil.copy(gzip1.path, path1)
+    shutil.copy(gzip2.path, path2)
     gzip1 = specialize(FilesystemFile(path1))
     gzip2 = specialize(FilesystemFile(path2))
     difference = gzip1.compare(gzip2).details
diff --git a/tests/comparators/test_xz.py b/tests/comparators/test_xz.py
index 11051d7..844fb1d 100644
--- a/tests/comparators/test_xz.py
+++ b/tests/comparators/test_xz.py
@@ -52,11 +52,11 @@ def test_content_source(differences):
     assert differences[0].source2 == 'test2'
 
 @skip_unless_tools_exist('xz')
-def test_content_source_without_extension(tmpdir):
+def test_content_source_without_extension(tmpdir, xz1, xz2):
     path1 = str(tmpdir.join('test1'))
     path2 = str(tmpdir.join('test2'))
-    shutil.copy(TEST_FILE1_PATH, path1)
-    shutil.copy(TEST_FILE2_PATH, path2)
+    shutil.copy(xz1.path, path1)
+    shutil.copy(xz2.path, path2)
     xz1 = specialize(FilesystemFile(path1))
     xz2 = specialize(FilesystemFile(path2))
     difference = xz1.compare(xz2).details
diff --git a/tests/comparators/test_zip.py b/tests/comparators/test_zip.py
index b28d7d7..125e494 100644
--- a/tests/comparators/test_zip.py
+++ b/tests/comparators/test_zip.py
@@ -74,11 +74,11 @@ def mozzip_differences(mozzip1, mozzip2):
     return mozzip1.compare(mozzip2).details
 
 @skip_unless_tools_exist('zipinfo')
-def test_mozzip_metadata(mozzip_differences):
+def test_mozzip_metadata(mozzip_differences, mozzip1, mozzip2):
     expected_diff = open(data('mozzip_zipinfo_expected_diff')).read()
     diff = mozzip_differences[0].unified_diff
-    assert (diff.replace(TEST_MOZZIP1_PATH, 'test1.mozzip')
-                .replace(TEST_MOZZIP2_PATH, 'test2.mozzip')) == expected_diff
+    assert (diff.replace(mozzip1.path, 'test1.mozzip')
+                .replace(mozzip2.path, 'test2.mozzip')) == expected_diff
 
 @skip_unless_tools_exist('zipinfo')
 def test_mozzip_compressed_files(mozzip_differences):

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


More information about the diffoscope mailing list