[diffoscope] 03/10: fix pep8 E306
Mattia Rizzolo
mattia at debian.org
Sat Sep 9 22:39:51 CEST 2017
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to branch master
in repository diffoscope.
commit da11ff910a6f5630aafa3f613527e7940f8f72ed
Author: Mattia Rizzolo <mattia at debian.org>
Date: Sat Sep 9 22:13:31 2017 +0200
fix pep8 E306
Signed-off-by: Mattia Rizzolo <mattia at debian.org>
---
diffoscope/comparators/elf.py | 1 +
diffoscope/comparators/zip.py | 1 +
diffoscope/presenters/html/html.py | 1 +
tests/comparators/test_binary.py | 5 +++++
tests/comparators/test_deb.py | 3 +++
tests/comparators/test_utils.py | 1 +
tests/test_difference.py | 1 +
7 files changed, 13 insertions(+)
diff --git a/diffoscope/comparators/elf.py b/diffoscope/comparators/elf.py
index 0e633c8..c31d8f7 100644
--- a/diffoscope/comparators/elf.py
+++ b/diffoscope/comparators/elf.py
@@ -507,6 +507,7 @@ class ElfContainer(Container):
# 2. Monkey-patch the ElfSection object created for the .gnu_debuglink
# to change the path to point to this new file
section = self._sections['.gnu_debuglink']
+
class MonkeyPatchedElfSection(section.__class__):
@property
def path(self):
diff --git a/diffoscope/comparators/zip.py b/diffoscope/comparators/zip.py
index c208b2b..0a49cd2 100644
--- a/diffoscope/comparators/zip.py
+++ b/diffoscope/comparators/zip.py
@@ -133,6 +133,7 @@ class MozillaZipContainer(ZipContainer):
# This is gross: Monkeypatch zipfile._EndRecData to work with
# Mozilla-optimized ZIPs
_orig_EndRecData = zipfile._EndRecData
+
def _EndRecData(fh):
endrec = _orig_EndRecData(fh)
if endrec:
diff --git a/diffoscope/presenters/html/html.py b/diffoscope/presenters/html/html.py
index 0971ed6..c17817c 100644
--- a/diffoscope/presenters/html/html.py
+++ b/diffoscope/presenters/html/html.py
@@ -275,6 +275,7 @@ def file_printer(directory, filename):
def spl_file_printer(directory, filename, accum):
with codecs.open(os.path.join(directory, filename), 'w', encoding='utf-8') as f:
print_func = f.write
+
def recording_print_func(s):
print_func(s)
recording_print_func.bytes_written += len(s)
diff --git a/tests/comparators/test_binary.py b/tests/comparators/test_binary.py
index 33d9c60..c8c4ba5 100644
--- a/tests/comparators/test_binary.py
+++ b/tests/comparators/test_binary.py
@@ -98,6 +98,7 @@ def test_compare_without_xxd(xxd_not_found, binary1, binary2):
def test_with_compare_details():
d = Difference('diff', TEST_FILE1_PATH, TEST_FILE2_PATH, source='source')
+
class MockFile(FilesystemFile):
def compare_details(self, other, source=None):
return [d]
@@ -124,6 +125,7 @@ def test_with_compare_details_and_no_actual_differences():
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_failed_process():
output = 'Free Jeremy Hammond'
+
class MockFile(FilesystemFile):
def compare_details(self, other, source=None):
subprocess.check_output(['sh', '-c', 'echo "%s"; exit 42' % output], shell=False)
@@ -137,6 +139,7 @@ def test_with_compare_details_and_failed_process():
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_parsing_error():
from diffoscope.exc import OutputParsingError
+
class MockFile(FilesystemFile):
def compare_details(self, other, source=None):
subprocess.check_output(['sh', '-c', 'exit 0'], shell=False)
@@ -149,6 +152,7 @@ def test_with_compare_details_and_parsing_error():
@skip_unless_tools_exist('xxd')
def test_with_compare_details_and_extraction_error():
from diffoscope.exc import ContainerExtractionError
+
class MockFile(FilesystemFile):
def compare_details(self, other, source=None):
subprocess.check_output(['sh', '-c', 'exit 0'], shell=False)
@@ -172,6 +176,7 @@ def test_with_compare_details_and_tool_not_found(monkeypatch):
'FreeBSD': 'some-package'
}
)
+
class MockFile(FilesystemFile):
@tool_required('nonexistent')
def compare_details(self, other, source=None):
diff --git a/tests/comparators/test_deb.py b/tests/comparators/test_deb.py
index 90a8bb4..002a2f4 100644
--- a/tests/comparators/test_deb.py
+++ b/tests/comparators/test_deb.py
@@ -60,6 +60,7 @@ def test_identification_of_md5sums_outside_deb(tmpdir):
def test_identification_of_md5sums_in_deb(deb1, deb2, monkeypatch):
orig_func = Md5sumsFile.recognizes
+
@staticmethod
def probe(file):
ret = orig_func(file)
@@ -80,6 +81,7 @@ def test_identical_files_in_md5sums(deb1, deb2):
def test_identification_of_data_tar(deb1, deb2, monkeypatch):
orig_func = DebDataTarFile.recognizes
+
@staticmethod
def probe(file):
ret = orig_func(file)
@@ -94,6 +96,7 @@ def test_identification_of_data_tar(deb1, deb2, monkeypatch):
def test_skip_comparison_of_known_identical_files(deb1, deb2, monkeypatch):
compared = set()
orig_func = diffoscope.comparators.utils.compare.compare_files
+
def probe(file1, file2, **kwargs):
compared.add(file1.name)
return orig_func(file1, file2, **kwargs)
diff --git a/tests/comparators/test_utils.py b/tests/comparators/test_utils.py
index e4f132f..831f319 100644
--- a/tests/comparators/test_utils.py
+++ b/tests/comparators/test_utils.py
@@ -53,6 +53,7 @@ def skip_unless_tool_is_at_least():
# pytest.skipif().args[0] contains the evaluated statement
assert func('cat', 1, 1).args[0] is False
assert func('cat', 1, '1.2d.45+b8').args[0] is True
+
def version():
return '4.3-git'
assert func('cat', version, '4.3').args[0] is False
diff --git a/tests/test_difference.py b/tests/test_difference.py
index 3c06c99..1b46e2f 100644
--- a/tests/test_difference.py
+++ b/tests/test_difference.py
@@ -80,6 +80,7 @@ def test_traverse_heapq():
diff.add_details([d0, d1, d2])
# traverse nodes in depth order, but at a given depth traverse the nodes
# there from smallest diff (counted non-recursively) to largest
+
def f(node, parscore):
depth = parscore[0] + 1 if parscore else 0
return depth, node.size_self()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git
More information about the diffoscope
mailing list