[diffoscope] 05/05: tests/comparators: DRY up init_fixture(data(FOO)) pattern with load_fixture(FOO)

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 9ee4a67917a2ca14681a56abd8b91d18fe6e5787
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Sun Jan 15 20:26:02 2017 +0100

    tests/comparators: DRY up init_fixture(data(FOO)) pattern with load_fixture(FOO)
---
 tests/comparators/test_apk.py             |  6 +++---
 tests/comparators/test_bzip2.py           |  8 +++-----
 tests/comparators/test_cpio.py            |  6 +++---
 tests/comparators/test_deb.py             |  6 +++---
 tests/comparators/test_dex.py             |  6 +++---
 tests/comparators/test_elf.py             |  6 +++---
 tests/comparators/test_epub.py            |  6 +++---
 tests/comparators/test_fonts.py           |  6 +++---
 tests/comparators/test_fsimage.py         |  6 +++---
 tests/comparators/test_gettext.py         | 10 +++++-----
 tests/comparators/test_git.py             |  6 +++---
 tests/comparators/test_gzip.py            |  9 +++------
 tests/comparators/test_haskell.py         |  6 +++---
 tests/comparators/test_icc.py             |  6 +++---
 tests/comparators/test_ico_image.py       | 10 +++++-----
 tests/comparators/test_ipk.py             |  6 +++---
 tests/comparators/test_iso9660.py         |  6 +++---
 tests/comparators/test_java.py            |  6 +++---
 tests/comparators/test_javascript.py      |  6 +++---
 tests/comparators/test_jpeg_image.py      | 10 +++++-----
 tests/comparators/test_json.py            | 10 +++++-----
 tests/comparators/test_macho.py           |  6 +++---
 tests/comparators/test_mono.py            |  6 +++---
 tests/comparators/test_openssh_pub_key.py |  6 +++---
 tests/comparators/test_pdf.py             |  6 +++---
 tests/comparators/test_png.py             |  6 +++---
 tests/comparators/test_ppu.py             |  6 +++---
 tests/comparators/test_ps.py              |  6 +++---
 tests/comparators/test_rlib.py            |  6 +++---
 tests/comparators/test_rpm.py             |  6 +++---
 tests/comparators/test_sqlite.py          |  6 +++---
 tests/comparators/test_squashfs.py        |  6 +++---
 tests/comparators/test_tar.py             |  8 ++++----
 tests/comparators/test_text.py            | 16 ++++++++--------
 tests/comparators/test_utils.py           | 12 ++++++------
 tests/comparators/test_xz.py              | 10 +++-------
 tests/comparators/test_zip.py             | 15 ++++++---------
 37 files changed, 131 insertions(+), 143 deletions(-)

diff --git a/tests/comparators/test_apk.py b/tests/comparators/test_apk.py
index 52028c5..b29154a 100644
--- a/tests/comparators/test_apk.py
+++ b/tests/comparators/test_apk.py
@@ -21,12 +21,12 @@ import pytest
 
 from diffoscope.comparators.apk import ApkFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
-apk1 = init_fixture(data('test1.apk'))
-apk2 = init_fixture(data('test2.apk'))
+apk1 = load_fixture('test1.apk')
+apk2 = load_fixture('test2.apk')
 
 def test_identification(apk1):
     assert isinstance(apk1, ApkFile)
diff --git a/tests/comparators/test_bzip2.py b/tests/comparators/test_bzip2.py
index 9a209f9..57540e9 100644
--- a/tests/comparators/test_bzip2.py
+++ b/tests/comparators/test_bzip2.py
@@ -24,16 +24,14 @@ from diffoscope.comparators.bzip2 import Bzip2File
 from diffoscope.comparators.binary import FilesystemFile
 from diffoscope.comparators.utils.specialize import specialize
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
 
-TEST_FILE1_PATH = data('test1.bz2')
-TEST_FILE2_PATH = data('test2.bz2')
+bzip1 = load_fixture('test1.bz2')
+bzip2 = load_fixture('test2.bz2')
 
-bzip1 = init_fixture(TEST_FILE1_PATH)
-bzip2 = init_fixture(TEST_FILE2_PATH)
 
 def test_identification(bzip1):
     assert isinstance(bzip1, Bzip2File)
diff --git a/tests/comparators/test_cpio.py b/tests/comparators/test_cpio.py
index c90950d..5c05200 100644
--- a/tests/comparators/test_cpio.py
+++ b/tests/comparators/test_cpio.py
@@ -21,13 +21,13 @@ import pytest
 
 from diffoscope.comparators.cpio import CpioFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
 
-cpio1 = init_fixture(data('test1.cpio'))
-cpio2 = init_fixture(data('test2.cpio'))
+cpio1 = load_fixture('test1.cpio')
+cpio2 = load_fixture('test2.cpio')
 
 def test_identification(cpio1):
     assert isinstance(cpio1, CpioFile)
diff --git a/tests/comparators/test_deb.py b/tests/comparators/test_deb.py
index 64eb059..4727d87 100644
--- a/tests/comparators/test_deb.py
+++ b/tests/comparators/test_deb.py
@@ -27,11 +27,11 @@ from diffoscope.comparators.binary import FilesystemFile
 from diffoscope.comparators.missing_file import MissingFile
 from diffoscope.comparators.utils.specialize import specialize
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 
 
-deb1 = init_fixture(data('test1.deb'))
-deb2 = init_fixture(data('test2.deb'))
+deb1 = load_fixture('test1.deb')
+deb2 = load_fixture('test2.deb')
 
 def test_identification(deb1):
     assert isinstance(deb1, DebFile)
diff --git a/tests/comparators/test_dex.py b/tests/comparators/test_dex.py
index b241062..f3c9012 100644
--- a/tests/comparators/test_dex.py
+++ b/tests/comparators/test_dex.py
@@ -24,15 +24,15 @@ from diffoscope.config import Config
 from diffoscope.comparators.dex import DexFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 from utils.nonexisting import assert_non_existing
 
 from test_java import javap_version
 
 
-dex1 = init_fixture(data('test1.dex'))
-dex2 = init_fixture(data('test2.dex'))
+dex1 = load_fixture('test1.dex')
+dex2 = load_fixture('test2.dex')
 
 def enjarify_version():
     # Module enjarify.typeinference appeared in enjarify 1.0.3.  We use a call
diff --git a/tests/comparators/test_elf.py b/tests/comparators/test_elf.py
index 62dfe53..64c41ba 100644
--- a/tests/comparators/test_elf.py
+++ b/tests/comparators/test_elf.py
@@ -28,7 +28,7 @@ from diffoscope.comparators.directory import FilesystemDirectory
 from diffoscope.comparators.missing_file import MissingFile
 from diffoscope.comparators.utils.specialize import specialize
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
@@ -38,8 +38,8 @@ try:
 except ImportError:
     miss_debian_module = True
 
-obj1 = init_fixture(data('test1.o'))
-obj2 = init_fixture(data('test2.o'))
+obj1 = load_fixture('test1.o')
+obj2 = load_fixture('test2.o')
 
 def test_obj_identification(obj1):
     assert isinstance(obj1, ElfFile)
diff --git a/tests/comparators/test_epub.py b/tests/comparators/test_epub.py
index 3a66b66..d0f0c7b 100644
--- a/tests/comparators/test_epub.py
+++ b/tests/comparators/test_epub.py
@@ -23,13 +23,13 @@ from diffoscope.config import Config
 from diffoscope.comparators.zip import ZipFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
 
-epub1 = init_fixture(data('test1.epub'))
-epub2 = init_fixture(data('test2.epub'))
+epub1 = load_fixture('test1.epub')
+epub2 = load_fixture('test2.epub')
 
 def test_identification(epub1):
     assert isinstance(epub1, ZipFile)
diff --git a/tests/comparators/test_fonts.py b/tests/comparators/test_fonts.py
index 177c107..7d9ff88 100644
--- a/tests/comparators/test_fonts.py
+++ b/tests/comparators/test_fonts.py
@@ -23,12 +23,12 @@ from diffoscope.config import Config
 from diffoscope.comparators.fonts import TtfFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
-ttf1 = init_fixture(data('Samyak-Malayalam1.ttf'))
-ttf2 = init_fixture(data('Samyak-Malayalam2.ttf'))
+ttf1 = load_fixture('Samyak-Malayalam1.ttf')
+ttf2 = load_fixture('Samyak-Malayalam2.ttf')
 
 def test_identification(ttf1):
     assert isinstance(ttf1, TtfFile)
diff --git a/tests/comparators/test_fsimage.py b/tests/comparators/test_fsimage.py
index ebae9df..6e36bee 100644
--- a/tests/comparators/test_fsimage.py
+++ b/tests/comparators/test_fsimage.py
@@ -23,7 +23,7 @@ from diffoscope.config import Config
 from diffoscope.comparators.missing_file import MissingFile
 from diffoscope.comparators.fsimage import FsImageFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
@@ -33,8 +33,8 @@ try:
 except ImportError:
     miss_guestfs = True
 
-img1 = init_fixture(data('test1.ext4'))
-img2 = init_fixture(data('test2.ext4'))
+img1 = load_fixture('test1.ext4')
+img2 = load_fixture('test2.ext4')
 
 def guestfs_working():
     if miss_guestfs:
diff --git a/tests/comparators/test_gettext.py b/tests/comparators/test_gettext.py
index 3d12d0a..ce81b63 100644
--- a/tests/comparators/test_gettext.py
+++ b/tests/comparators/test_gettext.py
@@ -24,12 +24,12 @@ from diffoscope.config import Config
 from diffoscope.comparators.missing_file import MissingFile
 from diffoscope.comparators.gettext import MoFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
-mo1 = init_fixture(data('test1.mo'))
-mo2 = init_fixture(data('test2.mo'))
+mo1 = load_fixture('test1.mo')
+mo2 = load_fixture('test2.mo')
 
 def test_identification(mo1):
     assert isinstance(mo1, MoFile)
@@ -47,8 +47,8 @@ def test_diff(differences):
     expected_diff = open(data('mo_expected_diff')).read()
     assert differences[0].unified_diff == expected_diff
 
-mo_no_charset = init_fixture(data('test_no_charset.mo'))
-mo_iso8859_1 = init_fixture(data('test_iso8859-1.mo'))
+mo_no_charset = load_fixture('test_no_charset.mo')
+mo_iso8859_1 = load_fixture('test_iso8859-1.mo')
 
 @skip_unless_tools_exist('msgunfmt')
 def test_charsets(mo_no_charset, mo_iso8859_1):
diff --git a/tests/comparators/test_git.py b/tests/comparators/test_git.py
index 074f1a0..0e2e0a0 100644
--- a/tests/comparators/test_git.py
+++ b/tests/comparators/test_git.py
@@ -21,11 +21,11 @@ import pytest
 
 from diffoscope.comparators.git import GitIndexFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 
 
-git1 = init_fixture(data('test1.git-index'))
-git2 = init_fixture(data('test2.git-index'))
+git1 = load_fixture('test1.git-index')
+git2 = load_fixture('test2.git-index')
 
 def test_identification(git1):
     assert isinstance(git1, GitIndexFile)
diff --git a/tests/comparators/test_gzip.py b/tests/comparators/test_gzip.py
index 52fb24e..5d2c7c2 100644
--- a/tests/comparators/test_gzip.py
+++ b/tests/comparators/test_gzip.py
@@ -26,16 +26,13 @@ from diffoscope.comparators.binary import FilesystemFile
 from diffoscope.comparators.missing_file import MissingFile
 from diffoscope.comparators.utils.specialize import specialize
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 
 
-TEST_FILE1_PATH = data('test1.gz')
-TEST_FILE2_PATH = data('test2.gz')
+gzip1 = load_fixture('test1.gz')
+gzip2 = load_fixture('test2.gz')
 
 
-gzip1 = init_fixture(TEST_FILE1_PATH)
-gzip2 = init_fixture(TEST_FILE2_PATH)
-
 def test_identification(gzip1):
     assert isinstance(gzip1, GzipFile)
 
diff --git a/tests/comparators/test_haskell.py b/tests/comparators/test_haskell.py
index f323a02..d15279c 100644
--- a/tests/comparators/test_haskell.py
+++ b/tests/comparators/test_haskell.py
@@ -22,12 +22,12 @@ import pytest
 from diffoscope.comparators.binary import FilesystemFile
 from diffoscope.comparators.haskell import HiFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
-haskell1 = init_fixture(data('test1.hi'))
-haskell2 = init_fixture(data('test2.hi'))
+haskell1 = load_fixture('test1.hi')
+haskell2 = load_fixture('test2.hi')
 
 @skip_unless_tools_exist('ghc')
 def test_identification(haskell1):
diff --git a/tests/comparators/test_icc.py b/tests/comparators/test_icc.py
index adf9e4b..b0a6020 100644
--- a/tests/comparators/test_icc.py
+++ b/tests/comparators/test_icc.py
@@ -23,12 +23,12 @@ from diffoscope.config import Config
 from diffoscope.comparators.icc import IccFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
-icc1 = init_fixture(data('test1.icc'))
-icc2 = init_fixture(data('test2.icc'))
+icc1 = load_fixture('test1.icc')
+icc2 = load_fixture('test2.icc')
 
 def test_identification(icc1):
     assert isinstance(icc1, IccFile)
diff --git a/tests/comparators/test_ico_image.py b/tests/comparators/test_ico_image.py
index 1c03751..a4051ff 100644
--- a/tests/comparators/test_ico_image.py
+++ b/tests/comparators/test_ico_image.py
@@ -22,15 +22,15 @@ import pytest
 from diffoscope.config import Config
 from diffoscope.comparators.image import ICOImageFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 from test_jpeg_image import identify_version
 
 
-image1 = init_fixture(data('test1.ico'))
-image2 = init_fixture(data('test2.ico'))
-image1_meta = init_fixture(data('test1_meta.ico'))
-image2_meta = init_fixture(data('test2_meta.ico'))
+image1 = load_fixture('test1.ico')
+image2 = load_fixture('test2.ico')
+image1_meta = load_fixture('test1_meta.ico')
+image2_meta = load_fixture('test2_meta.ico')
 
 def test_identification(image1):
     assert isinstance(image1, ICOImageFile)
diff --git a/tests/comparators/test_ipk.py b/tests/comparators/test_ipk.py
index c1e4235..4f04603 100644
--- a/tests/comparators/test_ipk.py
+++ b/tests/comparators/test_ipk.py
@@ -23,11 +23,11 @@ from diffoscope.config import Config
 from diffoscope.comparators.ipk import IpkFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 
 
-ipk1 = init_fixture(data('base-files_157-r45695_ar71xx.ipk'))
-ipk2 = init_fixture(data('base-files_157-r45918_ar71xx.ipk'))
+ipk1 = load_fixture('base-files_157-r45695_ar71xx.ipk')
+ipk2 = load_fixture('base-files_157-r45918_ar71xx.ipk')
 
 def test_identification(ipk1):
     assert isinstance(ipk1, IpkFile)
diff --git a/tests/comparators/test_iso9660.py b/tests/comparators/test_iso9660.py
index c3999f7..0147db3 100644
--- a/tests/comparators/test_iso9660.py
+++ b/tests/comparators/test_iso9660.py
@@ -23,12 +23,12 @@ from diffoscope.config import Config
 from diffoscope.comparators.missing_file import MissingFile
 from diffoscope.comparators.iso9660 import Iso9660File
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
-iso1 = init_fixture(data('test1.iso'))
-iso2 = init_fixture(data('test2.iso'))
+iso1 = load_fixture('test1.iso')
+iso2 = load_fixture('test2.iso')
 
 def test_identification(iso1):
     assert isinstance(iso1, Iso9660File)
diff --git a/tests/comparators/test_java.py b/tests/comparators/test_java.py
index 9152991..97e10a3 100644
--- a/tests/comparators/test_java.py
+++ b/tests/comparators/test_java.py
@@ -24,12 +24,12 @@ from diffoscope.config import Config
 from diffoscope.comparators.java import ClassFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 
 
-class1 = init_fixture(data('Test1.class'))
-class2 = init_fixture(data('Test2.class'))
+class1 = load_fixture('Test1.class')
+class2 = load_fixture('Test2.class')
 
 def javap_version():
     try:
diff --git a/tests/comparators/test_javascript.py b/tests/comparators/test_javascript.py
index db32026..7f2db12 100644
--- a/tests/comparators/test_javascript.py
+++ b/tests/comparators/test_javascript.py
@@ -23,12 +23,12 @@ from diffoscope.config import Config
 from diffoscope.comparators.javascript import JavaScriptFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
-javascript1 = init_fixture(data('test1.js'))
-javascript2 = init_fixture(data('test2.js'))
+javascript1 = load_fixture('test1.js')
+javascript2 = load_fixture('test2.js')
 
 def test_identification(javascript1):
     assert isinstance(javascript1, JavaScriptFile)
diff --git a/tests/comparators/test_jpeg_image.py b/tests/comparators/test_jpeg_image.py
index 784ef31..42552ff 100644
--- a/tests/comparators/test_jpeg_image.py
+++ b/tests/comparators/test_jpeg_image.py
@@ -24,14 +24,14 @@ from diffoscope.config import Config
 from diffoscope.comparators.image import JPEGImageFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 
 
-image1 = init_fixture(data('test1.jpg'))
-image2 = init_fixture(data('test2.jpg'))
-image1_meta = init_fixture(data('test1_meta.jpg'))
-image2_meta = init_fixture(data('test2_meta.jpg'))
+image1 = load_fixture('test1.jpg')
+image2 = load_fixture('test2.jpg')
+image1_meta = load_fixture('test1_meta.jpg')
+image2_meta = load_fixture('test2_meta.jpg')
 
 def identify_version():
     out = subprocess.check_output(['identify', '-version'])
diff --git a/tests/comparators/test_json.py b/tests/comparators/test_json.py
index 150d5a4..67c8b2c 100644
--- a/tests/comparators/test_json.py
+++ b/tests/comparators/test_json.py
@@ -21,14 +21,14 @@ import pytest
 
 from diffoscope.comparators.json import JSONFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.nonexisting import assert_non_existing
 
 
-json1 = init_fixture(data('test1.json'))
-json2 = init_fixture(data('test2.json'))
-json3a = init_fixture(data('order1a.json'))
-json3b = init_fixture(data('order1b.json'))
+json1 = load_fixture('test1.json')
+json2 = load_fixture('test2.json')
+json3a = load_fixture('order1a.json')
+json3b = load_fixture('order1b.json')
 
 def test_identification(json1):
     assert isinstance(json1, JSONFile)
diff --git a/tests/comparators/test_macho.py b/tests/comparators/test_macho.py
index 3d12764..d3b6816 100644
--- a/tests/comparators/test_macho.py
+++ b/tests/comparators/test_macho.py
@@ -25,12 +25,12 @@ from diffoscope.config import Config
 from diffoscope.comparators.macho import MachoFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
-obj1 = init_fixture(data('test1.macho'))
-obj2 = init_fixture(data('test2.macho'))
+obj1 = load_fixture('test1.macho')
+obj2 = load_fixture('test2.macho')
 
 def test_obj_identification(obj1):
     assert isinstance(obj1, MachoFile)
diff --git a/tests/comparators/test_mono.py b/tests/comparators/test_mono.py
index 8744160..6fdec5e 100644
--- a/tests/comparators/test_mono.py
+++ b/tests/comparators/test_mono.py
@@ -23,7 +23,7 @@ from diffoscope.config import Config
 from diffoscope.comparators.mono import MonoExeFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 
 
@@ -32,8 +32,8 @@ from utils.tools import skip_unless_tools_exist
 # echo 'public class Test { static public void Main () {} }' > test.cs
 # mcs -out:test1.exe test.cs ; sleep 2; mcs -out:test2.exe test.cs
 
-exe1 = init_fixture(data('test1.exe'))
-exe2 = init_fixture(data('test2.exe'))
+exe1 = load_fixture('test1.exe')
+exe2 = load_fixture('test2.exe')
 
 def test_identification(exe1):
     assert isinstance(exe1, MonoExeFile)
diff --git a/tests/comparators/test_openssh_pub_key.py b/tests/comparators/test_openssh_pub_key.py
index 236c5d7..bdb9280 100644
--- a/tests/comparators/test_openssh_pub_key.py
+++ b/tests/comparators/test_openssh_pub_key.py
@@ -24,14 +24,14 @@ from diffoscope.config import Config
 from diffoscope.comparators.openssh import PublicKeyFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 
 
 # Generated by: ssh-keygen -t dsa -C "Test1"
-opensshpubkey1 = init_fixture(data('test_openssh_pub_key1.pub'))
+opensshpubkey1 = load_fixture('test_openssh_pub_key1.pub')
 # Generated by: ssh-keygen -t rsa -b 4096 -C "Test2"
-opensshpubkey2 = init_fixture(data('test_openssh_pub_key2.pub'))
+opensshpubkey2 = load_fixture('test_openssh_pub_key2.pub')
 
 
 def openssh_version():
diff --git a/tests/comparators/test_pdf.py b/tests/comparators/test_pdf.py
index fd121a2..b415521 100644
--- a/tests/comparators/test_pdf.py
+++ b/tests/comparators/test_pdf.py
@@ -21,13 +21,13 @@ import pytest
 
 from diffoscope.comparators.pdf import PdfFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
 
-pdf1 = init_fixture(data('test1.pdf'))
-pdf2 = init_fixture(data('test2.pdf'))
+pdf1 = load_fixture('test1.pdf')
+pdf2 = load_fixture('test2.pdf')
 
 def test_identification(pdf1):
     assert isinstance(pdf1, PdfFile)
diff --git a/tests/comparators/test_png.py b/tests/comparators/test_png.py
index 26b1b62..5a328e2 100644
--- a/tests/comparators/test_png.py
+++ b/tests/comparators/test_png.py
@@ -21,13 +21,13 @@ import pytest
 
 from diffoscope.comparators.png import PngFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
 
-png1 = init_fixture(data('test1.png'))
-png2 = init_fixture(data('test2.png'))
+png1 = load_fixture('test1.png')
+png2 = load_fixture('test2.png')
 
 def test_identification(png1):
     assert isinstance(png1, PngFile)
diff --git a/tests/comparators/test_ppu.py b/tests/comparators/test_ppu.py
index c9e0d91..67814c5 100644
--- a/tests/comparators/test_ppu.py
+++ b/tests/comparators/test_ppu.py
@@ -23,7 +23,7 @@ import subprocess
 
 from diffoscope.comparators.ppu import PpuFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 from utils.nonexisting import assert_non_existing
 
@@ -34,8 +34,8 @@ from utils.nonexisting import assert_non_existing
 # castletexturefont_dejavusans_10.ppu which are generated during package
 # building of the cge package from dejavusans font in the fonts-dejavu package.
 
-file1 = init_fixture(data('test1.ppu'))
-file2 = init_fixture(data('test2.ppu'))
+file1 = load_fixture('test1.ppu')
+file2 = load_fixture('test2.ppu')
 
 def ppudump_version():
     # first line of `PPU-Analyser Version 3.0.0` looks like:
diff --git a/tests/comparators/test_ps.py b/tests/comparators/test_ps.py
index e03f829..dc77145 100644
--- a/tests/comparators/test_ps.py
+++ b/tests/comparators/test_ps.py
@@ -21,13 +21,13 @@ import pytest
 
 from diffoscope.comparators.ps import PsFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
 
-ps1 = init_fixture(data('test1.ps'))
-ps2 = init_fixture(data('test2.ps'))
+ps1 = load_fixture('test1.ps')
+ps2 = load_fixture('test2.ps')
 
 def test_identification(ps1):
     assert isinstance(ps1, PsFile)
diff --git a/tests/comparators/test_rlib.py b/tests/comparators/test_rlib.py
index 6ae7d07..bc89337 100644
--- a/tests/comparators/test_rlib.py
+++ b/tests/comparators/test_rlib.py
@@ -24,14 +24,14 @@ import subprocess
 from diffoscope.comparators.ar import ArFile
 
 from utils import diff_ignore_line_numbers
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 from utils.nonexisting import assert_non_existing
 
 
 
-rlib1 = init_fixture(data('test1.rlib'))
-rlib2 = init_fixture(data('test2.rlib'))
+rlib1 = load_fixture('test1.rlib')
+rlib2 = load_fixture('test2.rlib')
 
 def llvm_version():
     return subprocess.check_output(['llvm-config', '--version']).decode("utf-8").strip()
diff --git a/tests/comparators/test_rpm.py b/tests/comparators/test_rpm.py
index 62da4fe..57f0e58 100644
--- a/tests/comparators/test_rpm.py
+++ b/tests/comparators/test_rpm.py
@@ -19,7 +19,7 @@
 
 import pytest
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
@@ -31,8 +31,8 @@ except ImportError:
     from diffoscope.comparators.rpm_fallback import RpmFile
     miss_rpm_module = True
 
-rpm1 = init_fixture(data('test1.rpm'))
-rpm2 = init_fixture(data('test2.rpm'))
+rpm1 = load_fixture('test1.rpm')
+rpm2 = load_fixture('test2.rpm')
 
 def test_identification(rpm1):
     assert isinstance(rpm1, RpmFile)
diff --git a/tests/comparators/test_sqlite.py b/tests/comparators/test_sqlite.py
index dd754bd..29562e8 100644
--- a/tests/comparators/test_sqlite.py
+++ b/tests/comparators/test_sqlite.py
@@ -21,13 +21,13 @@ import pytest
 
 from diffoscope.comparators.sqlite import Sqlite3Database
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
 
-sqlite3db1 = init_fixture(data('test1.sqlite3'))
-sqlite3db2 = init_fixture(data('test2.sqlite3'))
+sqlite3db1 = load_fixture('test1.sqlite3')
+sqlite3db2 = load_fixture('test2.sqlite3')
 
 def test_identification(sqlite3db1):
     assert isinstance(sqlite3db1, Sqlite3Database)
diff --git a/tests/comparators/test_squashfs.py b/tests/comparators/test_squashfs.py
index 8d93c52..01564bd 100644
--- a/tests/comparators/test_squashfs.py
+++ b/tests/comparators/test_squashfs.py
@@ -22,7 +22,7 @@ import subprocess
 
 from diffoscope.comparators.squashfs import SquashfsFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
 from utils.nonexisting import assert_non_existing
 
@@ -36,8 +36,8 @@ def unsquashfs_version():
         out = e.output
     return out.decode('UTF-8').splitlines()[0].split()[2].strip()
 
-squashfs1 = init_fixture(data('test1.squashfs'))
-squashfs2 = init_fixture(data('test2.squashfs'))
+squashfs1 = load_fixture('test1.squashfs')
+squashfs2 = load_fixture('test2.squashfs')
 
 def test_identification(squashfs1):
     assert isinstance(squashfs1, SquashfsFile)
diff --git a/tests/comparators/test_tar.py b/tests/comparators/test_tar.py
index 88d0aa9..88bc408 100644
--- a/tests/comparators/test_tar.py
+++ b/tests/comparators/test_tar.py
@@ -23,12 +23,12 @@ from diffoscope.config import Config
 from diffoscope.comparators.tar import TarFile
 from diffoscope.comparators.missing_file import MissingFile
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.nonexisting import assert_non_existing
 
 
-tar1 = init_fixture(data('test1.tar'))
-tar2 = init_fixture(data('test2.tar'))
+tar1 = load_fixture('test1.tar')
+tar2 = load_fixture('test2.tar')
 
 def test_identification(tar1):
     assert isinstance(tar1, TarFile)
@@ -61,7 +61,7 @@ def test_text_file(differences):
 def test_compare_non_existing(monkeypatch, tar1):
     assert_non_existing(monkeypatch, tar1)
 
-no_permissions_tar = init_fixture(data('no-perms.tar'))
+no_permissions_tar = load_fixture('no-perms.tar')
 
 # Reported as Debian #797164. This is a good way to notice if we unpack directories
 # as we won't be able to remove files in one if we don't have write permissions.
diff --git a/tests/comparators/test_text.py b/tests/comparators/test_text.py
index 4308022..e109945 100644
--- a/tests/comparators/test_text.py
+++ b/tests/comparators/test_text.py
@@ -22,12 +22,12 @@ import codecs
 from diffoscope.comparators.binary import FilesystemFile
 from diffoscope.comparators.utils.specialize import specialize
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.nonexisting import assert_non_existing
 
 
-ascii1 = init_fixture(data('text_ascii1'))
-ascii2 = init_fixture(data('text_ascii2'))
+ascii1 = load_fixture('text_ascii1')
+ascii2 = load_fixture('text_ascii2')
 
 def test_no_differences(ascii1):
     difference = ascii1.compare(ascii1)
@@ -41,15 +41,15 @@ def test_difference_in_ascii(ascii1, ascii2):
     assert not difference.comments
     assert len(difference.details) == 0
 
-unicode1 = init_fixture(data('text_unicode1'))
-unicode2 = init_fixture(data('text_unicode2'))
+unicode1 = load_fixture('text_unicode1')
+unicode2 = load_fixture('text_unicode2')
 
 def test_difference_in_unicode(unicode1, unicode2):
     difference = unicode1.compare(unicode2)
     expected_diff = codecs.open(data('text_unicode_expected_diff'), encoding='utf-8').read()
     assert difference.unified_diff == expected_diff
 
-iso8859 = init_fixture(data('text_iso8859'))
+iso8859 = load_fixture('text_iso8859')
 
 def test_difference_between_iso88591_and_unicode(iso8859, unicode1):
     difference = iso8859.compare(unicode1)
@@ -68,8 +68,8 @@ def test_difference_between_iso88591_and_unicode_only(iso8859, tmpdir):
 def test_compare_non_existing(monkeypatch, ascii1):
     assert_non_existing(monkeypatch, ascii1, has_null_source=False, has_details=False)
 
-text_order1 = init_fixture(data('text_order1'))
-text_order2 = init_fixture(data('text_order2'))
+text_order1 = load_fixture('text_order1')
+text_order2 = load_fixture('text_order2')
 
 def test_ordering_differences(text_order1, text_order2):
     difference = text_order1.compare(text_order2)
diff --git a/tests/comparators/test_utils.py b/tests/comparators/test_utils.py
index 0f864c0..071c923 100644
--- a/tests/comparators/test_utils.py
+++ b/tests/comparators/test_utils.py
@@ -24,7 +24,7 @@ from diffoscope.config import Config
 from diffoscope.difference import Difference
 from diffoscope.comparators.utils.command import Command
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import tools_missing, skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
@@ -35,9 +35,9 @@ try:
 except ImportError:
     miss_tlsh = True
 
-fuzzy_tar1 = init_fixture(data('fuzzy1.tar'))
-fuzzy_tar2 = init_fixture(data('fuzzy2.tar'))
-fuzzy_tar3 = init_fixture(data('fuzzy3.tar'))
+fuzzy_tar1 = load_fixture('fuzzy1.tar')
+fuzzy_tar2 = load_fixture('fuzzy2.tar')
+fuzzy_tar3 = load_fixture('fuzzy3.tar')
 
 def test_tools_missing():
     assert tools_missing() is True
@@ -78,8 +78,8 @@ def test_fuzzy_matching_only_once(fuzzy_tar1, fuzzy_tar3):
     assert len(differences) == 2
     expected_diff = codecs.open(data('text_iso8859_expected_diff'), encoding='utf-8').read()
 
-fuzzy_tar_in_tar1 = init_fixture(data('fuzzy-tar-in-tar1.tar'))
-fuzzy_tar_in_tar2 = init_fixture(data('fuzzy-tar-in-tar2.tar'))
+fuzzy_tar_in_tar1 = load_fixture('fuzzy-tar-in-tar1.tar')
+fuzzy_tar_in_tar2 = load_fixture('fuzzy-tar-in-tar2.tar')
 
 @pytest.mark.skipif(miss_tlsh, reason='tlsh is missing')
 def test_no_fuzzy_matching(monkeypatch, fuzzy_tar_in_tar1, fuzzy_tar_in_tar2):
diff --git a/tests/comparators/test_xz.py b/tests/comparators/test_xz.py
index ead03db..40de745 100644
--- a/tests/comparators/test_xz.py
+++ b/tests/comparators/test_xz.py
@@ -24,16 +24,12 @@ from diffoscope.comparators.xz import XzFile
 from diffoscope.comparators.binary import FilesystemFile
 from diffoscope.comparators.utils.specialize import specialize
 
-from utils.data import data, init_fixture
+from utils.data import data, load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
-
-TEST_FILE1_PATH = data('test1.xz')
-TEST_FILE2_PATH = data('test2.xz')
-
-xz1 = init_fixture(TEST_FILE1_PATH)
-xz2 = init_fixture(TEST_FILE2_PATH)
+xz1 = load_fixture('test1.xz')
+xz2 = load_fixture('test2.xz')
 
 def test_identification(xz1):
     assert isinstance(xz1, XzFile)
diff --git a/tests/comparators/test_zip.py b/tests/comparators/test_zip.py
index 7491708..f95cef9 100644
--- a/tests/comparators/test_zip.py
+++ b/tests/comparators/test_zip.py
@@ -21,13 +21,16 @@ import pytest
 
 from diffoscope.comparators.zip import ZipFile, MozillaZipFile
 
-from utils.data import data, init_fixture
+from utils.data import load_fixture
 from utils.tools import skip_unless_tools_exist
 from utils.nonexisting import assert_non_existing
 
 
-zip1 = init_fixture(data('test1.zip'))
-zip2 = init_fixture(data('test2.zip'))
+zip1 = load_fixture('test1.zip')
+zip2 = load_fixture('test2.zip')
+mozzip1 = load_fixture('test1.mozzip')
+mozzip2 = load_fixture('test2.mozzip')
+
 
 def test_identification(zip1):
     assert isinstance(zip1, ZipFile)
@@ -56,12 +59,6 @@ def test_compressed_files(differences):
 def test_compare_non_existing(monkeypatch, zip1):
     assert_non_existing(monkeypatch, zip1)
 
-TEST_MOZZIP1_PATH = data('test1.mozzip')
-TEST_MOZZIP2_PATH = data('test2.mozzip')
-
-mozzip1 = init_fixture(TEST_MOZZIP1_PATH)
-mozzip2 = init_fixture(TEST_MOZZIP2_PATH)
-
 def test_mozzip_identification(mozzip1):
     assert isinstance(mozzip1, MozillaZipFile)
 

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


More information about the diffoscope mailing list