Example #1
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.image import ICOImageFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
from test_jpeg_image import identify_version

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)


def test_no_differences(image1):
    difference = image1.compare(image1)
    assert difference is None


@pytest.fixture
Example #2
0
import pytest

from diffoscope.config import Config
from diffoscope.comparators.mono import MonoExeFile
from diffoscope.comparators.missing_file import MissingFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist

# these were generated with:

# 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 = load_fixture('test1.exe')
exe2 = load_fixture('test2.exe')


def test_identification(exe1):
    assert isinstance(exe1, MonoExeFile)


def test_no_differences(exe1):
    difference = exe1.compare(exe1)
    assert difference is None


@pytest.fixture
def differences(exe1, exe2):
    return exe1.compare(exe2).details
Example #3
0
# diffoscope is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.git import GitIndexFile

from utils.data import get_data, load_fixture


git1 = load_fixture('test1.git-index')
git2 = load_fixture('test2.git-index')

def test_identification(git1):
    assert isinstance(git1, GitIndexFile)

def test_no_differences(git1):
    assert git1.compare(git1) is None

@pytest.fixture
def differences(git1, git2):
    return git1.compare(git2).details

def test_diff(differences):
    expected_diff = get_data('git_expected_diff')
    assert differences[0].unified_diff == expected_diff
Example #4
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.apk import ApkFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist
from utils.nonexisting import assert_non_existing

apk1 = load_fixture('test1.apk')
apk2 = load_fixture('test2.apk')


def test_identification(apk1):
    assert isinstance(apk1, ApkFile)


def test_no_differences(apk1):
    difference = apk1.compare(apk1)
    assert difference is None


@pytest.fixture
def differences(apk1, apk2):
    return apk1.compare(apk2).details
Example #5
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.png import PngFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist
from utils.nonexisting import assert_non_existing

png1 = load_fixture('test1.png')
png2 = load_fixture('test2.png')


def test_identification(png1):
    assert isinstance(png1, PngFile)


def test_no_differences(png1):
    difference = png1.compare(png1)
    assert difference is None


@pytest.fixture
def differences(png1, png2):
    return png1.compare(png2).details
Example #6
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.config import Config
from diffoscope.comparators.zip import ZipFile
from diffoscope.comparators.missing_file import MissingFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist


epub1 = load_fixture('test1.epub')
epub2 = load_fixture('test2.epub')

def test_identification(epub1):
    assert isinstance(epub1, ZipFile)

def test_no_differences(epub1):
    difference = epub1.compare(epub1)
    assert difference is None

@pytest.fixture
def differences(epub1, epub2):
    return epub1.compare(epub2).details

@skip_unless_tools_exist('zipinfo')
def test_differences(differences):
Example #7
0
from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
from utils.nonexisting import assert_non_existing


def unsquashfs_version():
    # first line of 'unsquashfs -version' looks like:
    #   unsquashfs version 4.2-git (2013/03/13)
    try:
        out = subprocess.check_output(['unsquashfs', '-version'])
    except subprocess.CalledProcessError as e:
        out = e.output
    return out.decode('UTF-8').splitlines()[0].split()[2].strip()

squashfs1 = load_fixture('test1.squashfs')
squashfs2 = load_fixture('test2.squashfs')

def test_identification(squashfs1):
    assert isinstance(squashfs1, SquashfsFile)

def test_no_differences(squashfs1):
    difference = squashfs1.compare(squashfs1)
    assert difference is None

def test_no_warnings(capfd, squashfs1, squashfs2):
    _ = squashfs1.compare(squashfs2)
    _, err = capfd.readouterr()
    assert err == ''

@pytest.fixture
Example #8
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.config import Config
from diffoscope.comparators.javascript import JavaScriptFile
from diffoscope.comparators.missing_file import MissingFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist


javascript1 = load_fixture('test1.js')
javascript2 = load_fixture('test2.js')

def test_identification(javascript1):
    assert isinstance(javascript1, JavaScriptFile)

def test_no_differences(javascript1):
    difference = javascript1.compare(javascript1)
    assert difference is None

@pytest.fixture
def differences(javascript1, javascript2):
    return javascript1.compare(javascript2).details

@skip_unless_tools_exist('js-beautify')
def test_diff(differences):
Example #9
0
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

import diffoscope.comparators

from diffoscope.config import Config
from diffoscope.comparators.deb import DebFile, Md5sumsFile, DebDataTarFile
from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.missing_file import MissingFile
from diffoscope.comparators.utils.specialize import specialize

from utils.data import load_fixture, get_data

deb1 = load_fixture('test1.deb')
deb2 = load_fixture('test2.deb')


def test_identification(deb1):
    assert isinstance(deb1, DebFile)


def test_no_differences(deb1):
    difference = deb1.compare(deb1)
    assert difference is None


@pytest.fixture
def differences(deb1, deb2):
    return deb1.compare(deb2).details
Example #10
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.haskell import HiFile

from utils.data import get_data, load_fixture
from utils.tools import skip_unless_tools_exist

haskell1 = load_fixture('test1.hi')
haskell2 = load_fixture('test2.hi')


@skip_unless_tools_exist('ghc')
def test_identification(haskell1):
    if isinstance(haskell1, FilesystemFile):
        pytest.skip("mismatch between system ghc and fixture")

    assert isinstance(haskell1, HiFile)


def test_no_differences(haskell1):
    assert haskell1.compare(haskell1) is None

Example #11
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.config import Config
from diffoscope.comparators.ipk import IpkFile
from diffoscope.comparators.missing_file import MissingFile

from utils.data import load_fixture, get_data

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)


def test_no_differences(ipk1):
    difference = ipk1.compare(ipk1)
    assert difference is None


@pytest.fixture
def differences(ipk1, ipk2):
    return ipk1.compare(ipk2).details
Example #12
0
import pytest

from diffoscope.comparators import ComparatorManager
from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.utils.specialize import specialize

from utils.data import load_fixture, data, get_data, normalize_zeros
from utils.tools import skip_unless_tools_exist, skip_unless_module_exists
from utils.nonexisting import assert_non_existing

try:
    from diffoscope.comparators.rpm import RpmFile
except ImportError:
    from diffoscope.comparators.rpm_fallback import RpmFile

rpm1 = load_fixture('test1.rpm')
rpm2 = load_fixture('test2.rpm')


def test_identification(rpm1):
    assert isinstance(rpm1, RpmFile)


@skip_unless_module_exists('rpm')
def test_no_differences(rpm1):
    difference = rpm1.compare(rpm1)
    assert difference is None


@pytest.fixture
def differences(rpm1, rpm2):
Example #13
0
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import codecs
import pytest

from diffoscope.config import Config
from diffoscope.difference import Difference
from diffoscope.comparators.utils.command import Command

from utils.data import data, load_fixture
from utils.tools import tools_missing, skip_unless_tools_exist, \
    skip_unless_module_exists

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
    assert tools_missing('/missing') is True
    for x in ['cat', 'sh']:
        assert tools_missing(x) is False


@skip_unless_tools_exist()
def test_skip_unless_tools_exist_empty():
    pytest.xfail("Test should always be skipped")
Example #14
0
# diffoscope is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.json import JSONFile

from utils.data import load_fixture, get_data
from utils.nonexisting import assert_non_existing

json1 = load_fixture('test1.json')
json2 = load_fixture('test2.json')
json3a = load_fixture('order1a.json')
json3b = load_fixture('order1b.json')
invalid_json = load_fixture('test_invalid.json')


def test_identification(json1):
    assert isinstance(json1, JSONFile)


def test_invalid(invalid_json):
    assert not isinstance(invalid_json, JSONFile)


def test_no_differences(json1):
Example #15
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest
import subprocess

from diffoscope.config import Config
from diffoscope.comparators.image import JPEGImageFile
from diffoscope.comparators.missing_file import MissingFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least

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'])
    # First line is expected to look like
    # "Version: ImageMagick 6.9.6-6 Q16 x86_64 20161125 ..."
    return out.decode('utf-8').splitlines()[0].split()[2].strip()


def test_identification(image1):
    assert isinstance(image1, JPEGImageFile)
Example #16
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.config import Config
from diffoscope.comparators.fonts import TtfFile
from diffoscope.comparators.missing_file import MissingFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist


ttf1 = load_fixture('Samyak-Malayalam1.ttf')
ttf2 = load_fixture('Samyak-Malayalam2.ttf')

def test_identification(ttf1):
    assert isinstance(ttf1, TtfFile)

def test_no_differences(ttf1):
    difference = ttf1.compare(ttf1)
    assert difference is None

@pytest.fixture
def differences(ttf1, ttf2):
    return ttf1.compare(ttf2).details

@skip_unless_tools_exist('showttf')
def test_diff(differences):
Example #17
0
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.config import Config
from diffoscope.comparators.missing_file import MissingFile
from diffoscope.comparators.iso9660 import Iso9660File

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist

iso1 = load_fixture('test1.iso')
iso2 = load_fixture('test2.iso')


def test_identification(iso1):
    assert isinstance(iso1, Iso9660File)


def test_no_differences(iso1):
    difference = iso1.compare(iso1)
    assert difference is None


@pytest.fixture
def differences(iso1, iso2):
    return iso1.compare(iso2).details
Example #18
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.zip import ZipFile, MozillaZipFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist
from utils.nonexisting import assert_non_existing

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)


def test_no_differences(zip1):
    difference = zip1.compare(zip1)
    assert difference is None


@pytest.fixture
Example #19
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import codecs

from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.utils.specialize import specialize

from utils.data import data, load_fixture, get_data
from utils.nonexisting import assert_non_existing

ascii1 = load_fixture('text_ascii1')
ascii2 = load_fixture('text_ascii2')


def test_no_differences(ascii1):
    difference = ascii1.compare(ascii1)
    assert difference is None


def test_difference_in_ascii(ascii1, ascii2):
    difference = ascii1.compare(ascii2)
    assert difference is not None
    expected_diff = get_data('text_ascii_expected_diff')
    assert difference.unified_diff == expected_diff
    assert not difference.comments
    assert len(difference.details) == 0
Example #20
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.ps import PsFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist
from utils.nonexisting import assert_non_existing

ps1 = load_fixture('test1.ps')
ps2 = load_fixture('test2.ps')


def test_identification(ps1):
    assert isinstance(ps1, PsFile)


def test_no_differences(ps1):
    difference = ps1.compare(ps1)
    assert difference is None


@pytest.fixture
def differences(ps1, ps2):
    return ps1.compare(ps2)
Example #21
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.cpio import CpioFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist
from utils.nonexisting import assert_non_existing

cpio1 = load_fixture('test1.cpio')
cpio2 = load_fixture('test2.cpio')


def test_identification(cpio1):
    assert isinstance(cpio1, CpioFile)


def test_no_differences(cpio1):
    difference = cpio1.compare(cpio1)
    assert difference is None


@pytest.fixture
def differences(cpio1, cpio2):
    return cpio1.compare(cpio2).details
Example #22
0
import pytest
import os.path

from diffoscope.config import Config
from diffoscope.comparators.elf import ElfFile, StaticLibFile
from diffoscope.comparators.binary import FilesystemFile
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, load_fixture, get_data
from utils.tools import skip_unless_tools_exist, \
    skip_if_binutils_does_not_support_x86, skip_unless_module_exists

obj1 = load_fixture('test1.o')
obj2 = load_fixture('test2.o')


def test_obj_identification(obj1):
    assert isinstance(obj1, ElfFile)


def test_obj_no_differences(obj1):
    difference = obj1.compare(obj1)
    assert difference is None


@pytest.fixture
def obj_differences(obj1, obj2):
    return obj1.compare(obj2).details
Example #23
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import codecs
import pytest

from diffoscope.config import Config
from diffoscope.comparators.missing_file import MissingFile
from diffoscope.comparators.gettext import MoFile

from utils.data import data, load_fixture, get_data
from utils.tools import skip_unless_tools_exist

mo1 = load_fixture('test1.mo')
mo2 = load_fixture('test2.mo')


def test_identification(mo1):
    assert isinstance(mo1, MoFile)


def test_no_differences(mo1):
    difference = mo1.compare(mo1)
    assert difference is None


@pytest.fixture
def differences(mo1, mo2):
    return mo1.compare(mo2).details
Example #24
0
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import shutil
import pytest

from diffoscope.comparators.xz import XzFile
from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.utils.specialize import specialize

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist
from utils.nonexisting import assert_non_existing

xz1 = load_fixture('test1.xz')
xz2 = load_fixture('test2.xz')


def test_identification(xz1):
    assert isinstance(xz1, XzFile)


def test_no_differences(xz1):
    difference = xz1.compare(xz1)
    assert difference is None


@pytest.fixture
def differences(xz1, xz2):
    return xz1.compare(xz2).details
Example #25
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest

from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.device import Device
from diffoscope.comparators.utils.specialize import specialize

from utils.data import load_fixture, get_data, normalize_zeros
from utils.tools import skip_unless_tools_exist


text_ascii1 = load_fixture('text_ascii1')

@pytest.fixture
def devnull():
    return specialize(FilesystemFile('/dev/null'))

@pytest.fixture
def differences(devnull, text_ascii1):
    return devnull.compare_bytes(text_ascii1)

@pytest.fixture
def differences_reverse(text_ascii1, devnull):
    return text_ascii1.compare_bytes(devnull)

def test_identification(devnull):
    assert isinstance(devnull, Device)
Example #26
0
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest
import subprocess

from diffoscope.config import Config
from diffoscope.comparators.openssh import PublicKeyFile
from diffoscope.comparators.missing_file import MissingFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least


# Generated by: ssh-keygen -t dsa -C "Test1"
opensshpubkey1 = load_fixture('test_openssh_pub_key1.pub')
# Generated by: ssh-keygen -t rsa -b 4096 -C "Test2"
opensshpubkey2 = load_fixture('test_openssh_pub_key2.pub')


def openssh_version():
    out = subprocess.check_output(('ssh', '-V'), stderr=subprocess.STDOUT)
    return out.decode().split()[0].split('_')[1]


def test_identification(opensshpubkey1):
    assert isinstance(opensshpubkey1, PublicKeyFile)

def test_no_differences(opensshpubkey1):
    difference = opensshpubkey1.compare(opensshpubkey1)
    assert difference is None
Example #27
0
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import pytest
import subprocess

from diffoscope.comparators.ar import ArFile

from utils import diff_ignore_line_numbers
from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least, \
    skip_if_binutils_does_not_support_x86
from utils.nonexisting import assert_non_existing

rlib1 = load_fixture('test1.rlib')
rlib2 = load_fixture('test2.rlib')


def llvm_version():
    return subprocess.check_output(['llvm-config',
                                    '--version']).decode("utf-8").strip()


def test_identification(rlib1):
    assert isinstance(rlib1, ArFile)


def test_no_differences(rlib1):
    difference = rlib1.compare(rlib1)
    assert difference is None
Example #28
0
#
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import shutil
import pytest

from diffoscope.comparators.bzip2 import Bzip2File
from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.utils.specialize import specialize

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist
from utils.nonexisting import assert_non_existing

bzip1 = load_fixture('test1.bz2')
bzip2 = load_fixture('test2.bz2')


def test_identification(bzip1):
    assert isinstance(bzip1, Bzip2File)


def test_no_differences(bzip1):
    difference = bzip1.compare(bzip1)
    assert difference is None


@pytest.fixture
def differences(bzip1, bzip2):
    return bzip1.compare(bzip2).details
Example #29
0
# You should have received a copy of the GNU General Public License
# along with diffoscope.  If not, see <https://www.gnu.org/licenses/>.

import shutil
import pytest

from diffoscope.config import Config
from diffoscope.comparators.gzip import GzipFile
from diffoscope.comparators.binary import FilesystemFile
from diffoscope.comparators.missing_file import MissingFile
from diffoscope.comparators.utils.specialize import specialize

from utils.data import load_fixture, get_data


gzip1 = load_fixture('test1.gz')
gzip2 = load_fixture('test2.gz')


def test_identification(gzip1):
    assert isinstance(gzip1, GzipFile)

def test_no_differences(gzip1):
    difference = gzip1.compare(gzip1)
    assert difference is None

@pytest.fixture
def differences(gzip1, gzip2):
    return gzip1.compare(gzip2).details

def test_metadata(differences):
Example #30
0
import subprocess

from diffoscope.comparators.ppu import PpuFile

from utils.data import load_fixture, get_data
from utils.tools import skip_unless_tools_exist, skip_unless_tool_is_at_least
from utils.nonexisting import assert_non_existing


# These test files were taken from two different builds of the Debian package
# fp-units-castle-game-engine (version 5.1.1-2 on amd64) on the Debian
# reproducible build infrastructure. The files were originally called
# castletexturefont_dejavusans_10.ppu which are generated during package
# building of the cge package from dejavusans font in the fonts-dejavu package.

file1 = load_fixture('test1.ppu')
file2 = load_fixture('test2.ppu')

def ppudump_version():
    # first line of `PPU-Analyser Version 3.0.0` looks like:
    #   PPU-Analyser Version 3.0.0
    out = subprocess.check_output(['ppudump', '-h'])
    return out.decode('utf-8').splitlines()[0].split()[2].strip()

@skip_unless_tools_exist('ppudump')
def test_identification(file1):
    assert isinstance(file1, PpuFile)

def test_no_differences(file1):
    difference = file1.compare(file1)
    assert difference is None