[diffoscope] 02/02: tests: fix progressbar failure that was exposed by the previous importing fixes

Ximin Luo infinity0 at debian.org
Fri Jun 30 20:01:19 CEST 2017


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

infinity0 pushed a commit to branch master
in repository diffoscope.

commit 8130f638ee11d727b3b51811bfc0b928967dfc29
Author: Ximin Luo <infinity0 at debian.org>
Date:   Fri Jun 30 20:00:54 2017 +0200

    tests: fix progressbar failure that was exposed by the previous importing fixes
---
 diffoscope/progress.py | 6 +++++-
 tests/utils/tools.py   | 2 +-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/diffoscope/progress.py b/diffoscope/progress.py
index b00dd48..20ae769 100644
--- a/diffoscope/progress.py
+++ b/diffoscope/progress.py
@@ -24,7 +24,6 @@ import logging
 
 logger = logging.getLogger(__name__)
 
-
 class ProgressLoggingHandler(logging.StreamHandler):
 
     def __init__(self, progressbar):
@@ -201,6 +200,11 @@ class ProgressBar(object):
                 return '…{}'.format(msg[-width + 1:])
 
         class OurProgressBar(progressbar.ProgressBar):
+            def __init__(self, *args, **kwargs):
+                # Remove after https://github.com/niltonvolpato/python-progressbar/pull/57 is fixed.
+                kwargs.setdefault("fd", sys.stderr)
+                super().__init__(*args, **kwargs)
+
             def _need_update(self):
                 return True
 
diff --git a/tests/utils/tools.py b/tests/utils/tools.py
index 4b96405..20b3af9 100644
--- a/tests/utils/tools.py
+++ b/tests/utils/tools.py
@@ -69,7 +69,7 @@ def module_is_not_importable(x):
         # modules are not available, e.g. if we are running diffoscope using a
         # non-default version of python, and the module uses extension modules
         # that haven't been compiled for this version
-        __import__(x)
+        importlib.import_module(x)
     except ImportError:
         # Probing for submodules (eg. ``debian.deb822``) will attempt to
         # import ``debian`` so we must handle that failing.

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


More information about the diffoscope mailing list