Skip to content

Commit dc79350

Browse files
Fix: Properly update the verbosity in PDF comparator
1 parent e173284 commit dc79350

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

dir_content_diff/base_comparators.py

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Module containing the base comparators."""
22

33
# LICENSE HEADER MANAGED BY add-license-header
4-
# Copyright (c) 2023-2024 Blue Brain Project, EPFL.
4+
# Copyright (c) 2023-2025 Blue Brain Project, EPFL.
55
#
66
# This file is part of dir-content-diff.
77
# See https://github.com/BlueBrain/dir-content-diff for further info.
@@ -667,21 +667,16 @@ def __call__(self, ref_file, comp_file, *args, **kwargs):
667667

668668
try:
669669
# Update default verbosity
670+
current_default_verbosity = int(
671+
diff_pdf_visually.constants.DEFAULT_VERBOSITY
672+
)
670673
if "verbosity" not in kwargs: # pragma: no branch
671-
current_default_verbosity = int(
672-
diff_pdf_visually.constants.DEFAULT_VERBOSITY
673-
)
674-
try:
675-
if (
676-
diff_pdf_visually.diff.pdfdiff_pages.__defaults__[1] is None
677-
): # pragma: no cover
678-
diff_pdf_visually.constants.DEFAULT_VERBOSITY = 0
679-
else:
680-
kwargs["verbosity"] = 0
681-
finally:
682-
diff_pdf_visually.constants.DEFAULT_VERBOSITY = (
683-
current_default_verbosity
684-
)
674+
if (
675+
diff_pdf_visually.diff.pdfdiff_pages.__defaults__[1] is None
676+
): # pragma: no cover
677+
diff_pdf_visually.constants.DEFAULT_VERBOSITY = 0
678+
else:
679+
kwargs["verbosity"] = 0
685680
return super().__call__(ref_file, comp_file, *args, **kwargs)
686681
finally:
687682
diff_pdf_visually.constants.DEFAULT_VERBOSITY = current_default_verbosity

0 commit comments

Comments
 (0)