[pygobject] tests: pyflakes/pep8 fixes



commit 0fe781efdd46386f7c373b6073d30411025e2854
Author: Christoph Reiter <creiter src gnome org>
Date:   Tue Aug 22 13:02:43 2017 +0200

    tests: pyflakes/pep8 fixes
    
    Make Python 3 pyflakes work by adding Python 2 builtins
    through PYFLAKES_BUILTINS.

 Makefile.am                    |    4 ++--
 tests/test_import_machinery.py |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 4c91362..4d1fdda 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -139,12 +139,12 @@ dist-hook: $(BUILT_EXTRA_DIST)
 check.quality:
        @echo "  CHECK  Pyflakes" $(pycheck_dirs)
        @if type pyflakes >/dev/null 2>&1; then \
-               (cd $(abs_top_srcdir) && pyflakes $(pycheck_dirs) ); \
+               (cd $(abs_top_srcdir) && PYFLAKES_BUILTINS="basestring,long,unicode" pyflakes $(pycheck_dirs) 
); \
        else echo "skipped, pyflakes not installed"; \
        fi
        @echo "  CHECK  PEP8";
        @if type pep8 >/dev/null 2>&1; then \
-               (cd $(abs_top_srcdir) && pep8 --ignore=E501,E123,E124,E402,E731 --repeat --show-source 
$(pycheck_dirs) ); \
+               (cd $(abs_top_srcdir) && pep8 --ignore=E501,E123,E124,E402,E731,E722 --repeat --show-source 
$(pycheck_dirs) ); \
        else echo "skipped, pep8 not installed"; \
        fi
 
diff --git a/tests/test_import_machinery.py b/tests/test_import_machinery.py
index bdc1a72..f1a5f30 100644
--- a/tests/test_import_machinery.py
+++ b/tests/test_import_machinery.py
@@ -142,14 +142,14 @@ class TestImporter(unittest.TestCase):
 
     def test_require_version_versiontype(self):
         import gi
-        with self.assertRaises(ValueError) as context:
+        with self.assertRaises(ValueError):
             gi.require_version('GLib', 2.0)
 
         # Test that unicode strings work in python 2
         if sys.version_info[0] <= 2:
             gi.require_version('GLib', unicode('2.0'))
         else:
-            with self.assertRaises(ValueError) as context:
+            with self.assertRaises(ValueError):
                 gi.require_version('GLib', b'2.0')
 
     def test_require_versions(self):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]