Patchwork [06,of,10] filterpyflakes: allow reexporting pure symbols from cffi modules

login
register
mail settings
Submitter Yuya Nishihara
Date May 28, 2017, 1:05 p.m.
Message ID <0120b66d89008c4baece.1495976711@mimosa>
Download mbox | patch
Permalink /patch/20979/
State Accepted
Headers show

Comments

Yuya Nishihara - May 28, 2017, 1:05 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1495960561 -32400
#      Sun May 28 17:36:01 2017 +0900
# Node ID 0120b66d89008c4baece3eb03cee66a55b572452
# Parent  07e2ebf8603fce9789bea6c35c70390f14aabf5b
filterpyflakes: allow reexporting pure symbols from cffi modules

cffi modules will do 'from ..pure.<module> import *'.

Patch

diff --git a/tests/filterpyflakes.py b/tests/filterpyflakes.py
--- a/tests/filterpyflakes.py
+++ b/tests/filterpyflakes.py
@@ -13,6 +13,9 @@  for line in sys.stdin:
     pats = [
         r"undefined name 'WindowsError'",
         r"redefinition of unused '[^']+' from line",
+        # for cffi, allow re-exports from pure.*
+        r"cffi/[^:]*:.*\bimport \*' used",
+        r"cffi/[^:]*:.*\*' imported but unused",
     ]
 
     keep = True
diff --git a/tests/test-check-pyflakes.t b/tests/test-check-pyflakes.t
--- a/tests/test-check-pyflakes.t
+++ b/tests/test-check-pyflakes.t
@@ -10,5 +10,5 @@  run pyflakes on all tracked files ending
   > -X mercurial/pycompat.py -X contrib/python-zstandard \
   > 2>/dev/null \
   > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py"
-  tests/filterpyflakes.py:38: undefined name 'undefinedname'
+  tests/filterpyflakes.py:41: undefined name 'undefinedname'