jenkins-bot has submitted this change. ( 
https://gerrit.wikimedia.org/r/c/pywikibot/core/+/667211 )

Change subject: [flake8] Enable flake8 tests for Python 3.6
......................................................................

[flake8] Enable flake8 tests for Python 3.6

Some flake8 plugins does not support deprecated Python 3.5 anymore.
Therefore enable flake8 tests with Python 3.6 too.

Fix flake8 issues of newer addons

Change-Id: I1c5f545ed931e946746a061106c0f2b6dd4944b7
---
M pywikibot/i18n.py
M pywikibot/tools/__init__.py
M scripts/download_dump.py
M scripts/replace.py
M tox.ini
5 files changed, 9 insertions(+), 10 deletions(-)

Approvals:
  Xqt: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/pywikibot/i18n.py b/pywikibot/i18n.py
index 958ff50..688cfd8 100644
--- a/pywikibot/i18n.py
+++ b/pywikibot/i18n.py
@@ -429,7 +429,7 @@
     try:
         trans_text = pkgutil.get_data(
             _messages_package_name, filename).decode('utf-8')
-    except (OSError, IOError):  # file open can cause several exceptions
+    except OSError:  # file open can cause several exceptions
         return None

     transdict = json.loads(trans_text)
diff --git a/pywikibot/tools/__init__.py b/pywikibot/tools/__init__.py
index fc34c73..829a4f9 100644
--- a/pywikibot/tools/__init__.py
+++ b/pywikibot/tools/__init__.py
@@ -805,10 +805,9 @@
                 pass
             except KeyboardInterrupt:
                 thrlist.stop_all()
-            finally:
-                # All threads are done.
-                if thrlist.active_count() == 0:
-                    return
+            # All threads are done.
+            if thrlist.active_count() == 0:
+                return


 def roundrobin_generators(*iterables):
diff --git a/scripts/download_dump.py b/scripts/download_dump.py
index 74e9a8d..98517fa 100755
--- a/scripts/download_dump.py
+++ b/scripts/download_dump.py
@@ -157,12 +157,12 @@
                     replace(file_current_storepath, file_final_storepath)
                     break

-            except (OSError, IOError):
+            except OSError:
                 pywikibot.exception()

                 try:
                     remove(file_current_storepath)
-                except (OSError, IOError):
+                except OSError:
                     pywikibot.exception()

                 # If the atomic download fails, try without a temporary file
diff --git a/scripts/replace.py b/scripts/replace.py
index 5497f44..a9187e8 100755
--- a/scripts/replace.py
+++ b/scripts/replace.py
@@ -911,7 +911,7 @@
             with codecs.open(replacement_file, 'r', 'utf-8') as f:
                 # strip newlines, but not other characters
                 file_replacements = f.read().splitlines()
-        except (IOError, OSError) as e:
+        except OSError as e:
             pywikibot.error('Error loading {0}: {1}'.format(
                 replacement_file, e))
             return False
diff --git a/tox.ini b/tox.ini
index 3c9d67a..eadafdc 100644
--- a/tox.ini
+++ b/tox.ini
@@ -5,7 +5,7 @@
 skip_missing_interpreters = True
 envlist =
     commit-message
-    flake8-{py35}
+    flake8-{py35,py36}

 [params]
 doctest_skip = --ignore-files=(_revision|eventstreams|gui|mysql)\.py
@@ -14,6 +14,7 @@
 [testenv]
 basepython =
     py35: python3.5
+    py36: python3.6
     py37: python3.7
     py38: python3.8
 setenv =
@@ -46,7 +47,6 @@
 deps = commit-message-validator
 commands = commit-message-validator

-
 [testenv:doctest]
 basepython = python3
 commands =

--
To view, visit https://gerrit.wikimedia.org/r/c/pywikibot/core/+/667211
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.wikimedia.org/r/settings

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Change-Id: I1c5f545ed931e946746a061106c0f2b6dd4944b7
Gerrit-Change-Number: 667211
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot
Gerrit-MessageType: merged
_______________________________________________
Pywikibot-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/pywikibot-commits

Reply via email to