Patchwork [5,of,5] tests: enable import checker for all python files (including no .py files)

login
register
mail settings
Submitter Yuya Nishihara
Date May 24, 2016, 2:32 p.m.
Message ID <e14076fabb922f83d062.1464100373@mimosa>
Download mbox | patch
Permalink /patch/15191/
State Accepted
Headers show

Comments

Yuya Nishihara - May 24, 2016, 2:32 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1463276885 -32400
#      Sun May 15 10:48:05 2016 +0900
# Node ID e14076fabb922f83d062e46971058fa0a35a4ff1
# Parent  4d300af3b3f7fb3d4664b4fc577c4714747a03e2
tests: enable import checker for all python files (including no .py files)

i18n/posplit is excluded as it couldn't be trivially fixed. That's the same
as 99a2bdad0fda.
Augie Fackler - May 24, 2016, 3:06 p.m.
On Tue, May 24, 2016 at 11:32:53PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1463276885 -32400
> #      Sun May 15 10:48:05 2016 +0900
> # Node ID e14076fabb922f83d062e46971058fa0a35a4ff1
> # Parent  4d300af3b3f7fb3d4664b4fc577c4714747a03e2
> tests: enable import checker for all python files (including no .py files)

Queued these, very nice work.

>
> i18n/posplit is excluded as it couldn't be trivially fixed. That's the same
> as 99a2bdad0fda.
>
> diff --git a/contrib/import-checker.py b/contrib/import-checker.py
> --- a/contrib/import-checker.py
> +++ b/contrib/import-checker.py
> @@ -663,7 +663,7 @@ def sources(f, modname):
>      the input file.
>      """
>      py = False
> -    if f.endswith('.py'):
> +    if not f.endswith('.t'):
>          with open(f) as src:
>              yield src.read(), modname, f, 0
>              py = True
> diff --git a/tests/test-check-module-imports.t b/tests/test-check-module-imports.t
> --- a/tests/test-check-module-imports.t
> +++ b/tests/test-check-module-imports.t
> @@ -155,12 +155,13 @@ these may expose other cycles.
>  Known-bad files are excluded by -X as some of them would produce unstable
>  outputs, which should be fixed later.
>
> -  $ hg locate '**.py' \
> +  $ hg locate 'set:**.py or grep(r"^#!.*?python")' \
>    > 'tests/**.t' \
>    > -X contrib/debugshell.py \
>    > -X contrib/win32/hgwebdir_wsgi.py \
>    > -X doc/gendoc.py \
>    > -X doc/hgmanpage.py \
> +  > -X i18n/posplit \
>    > -X tests/test-hgweb-auth.py \
>    > -X tests/hypothesishelpers.py \
>    > -X tests/test-ctxmanager.py \
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Patch

diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -663,7 +663,7 @@  def sources(f, modname):
     the input file.
     """
     py = False
-    if f.endswith('.py'):
+    if not f.endswith('.t'):
         with open(f) as src:
             yield src.read(), modname, f, 0
             py = True
diff --git a/tests/test-check-module-imports.t b/tests/test-check-module-imports.t
--- a/tests/test-check-module-imports.t
+++ b/tests/test-check-module-imports.t
@@ -155,12 +155,13 @@  these may expose other cycles.
 Known-bad files are excluded by -X as some of them would produce unstable
 outputs, which should be fixed later.
 
-  $ hg locate '**.py' \
+  $ hg locate 'set:**.py or grep(r"^#!.*?python")' \
   > 'tests/**.t' \
   > -X contrib/debugshell.py \
   > -X contrib/win32/hgwebdir_wsgi.py \
   > -X doc/gendoc.py \
   > -X doc/hgmanpage.py \
+  > -X i18n/posplit \
   > -X tests/test-hgweb-auth.py \
   > -X tests/hypothesishelpers.py \
   > -X tests/test-ctxmanager.py \