Patchwork [7,of,7] tests: enable import checker for tests/**.py files

login
register
mail settings
Submitter Yuya Nishihara
Date April 9, 2016, 10:56 a.m.
Message ID <fe84c869007da526bb07.1460199379@mimosa>
Download mbox | patch
Permalink /patch/14465/
State Accepted
Headers show

Comments

Yuya Nishihara - April 9, 2016, 10:56 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1459679937 -32400
#      Sun Apr 03 19:38:57 2016 +0900
# Node ID fe84c869007da526bb07c0ed54d3493d04b7dfcd
# Parent  fa1fbae246e0dd2dfa2bd27c2f20f9d224f1f166
tests: enable import checker for tests/**.py files

Several known-bad files are excluded as they couldn't be trivially fixed.
In principle, we should fix them first, however, it would have more risk
to keep Py3k porting going without the test coverage.

Still contrib/**.py aren't covered, which needs another round.
Augie Fackler - April 10, 2016, 4:20 p.m.
On Sat, Apr 09, 2016 at 07:56:19PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@tcha.org>
> # Date 1459679937 -32400
> #      Sun Apr 03 19:38:57 2016 +0900
> # Node ID fe84c869007da526bb07c0ed54d3493d04b7dfcd
> # Parent  fa1fbae246e0dd2dfa2bd27c2f20f9d224f1f166
> tests: enable import checker for tests/**.py files

Queued these, thanks.

Have you done the work on contrib/**.py already, or should I tackle
that? Either way is fine.

>
> Several known-bad files are excluded as they couldn't be trivially fixed.
> In principle, we should fix them first, however, it would have more risk
> to keep Py3k porting going without the test coverage.
>
> Still contrib/**.py aren't covered, which needs another round.
>
> 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
> @@ -141,6 +141,15 @@ here that we should still endeavor to fi
>  hidden by deduplication algorithm in the cycle detector, so fixing
>  these may expose other cycles.
>
> -  $ hg locate 'mercurial/**.py' 'hgext/**.py' | sed 's-\\-/-g' | python "$import_checker" -
> +Known-bad files are excluded by -X as some of them would produce unstable
> +outputs, which should be fixed later.
> +
> +  $ hg locate 'mercurial/**.py' 'hgext/**.py' 'tests/**.py' \
> +  > -X tests/test-hgweb-auth.py \
> +  > -X tests/hypothesishelpers.py \
> +  > -X tests/test-ctxmanager.py \
> +  > -X tests/test-lock.py \
> +  > -X tests/test-verify-repo-operations.py \
> +  > | sed 's-\\-/-g' | python "$import_checker" -
>    Import cycle: hgext.largefiles.basestore -> hgext.largefiles.localstore -> hgext.largefiles.basestore
>    [1]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Yuya Nishihara - April 11, 2016, 11:30 a.m.
On Sun, 10 Apr 2016 12:20:41 -0400, Augie Fackler wrote:
> On Sat, Apr 09, 2016 at 07:56:19PM +0900, Yuya Nishihara wrote:
> > # HG changeset patch
> > # User Yuya Nishihara <yuya@tcha.org>
> > # Date 1459679937 -32400
> > #      Sun Apr 03 19:38:57 2016 +0900
> > # Node ID fe84c869007da526bb07c0ed54d3493d04b7dfcd
> > # Parent  fa1fbae246e0dd2dfa2bd27c2f20f9d224f1f166
> > tests: enable import checker for tests/**.py files  
> 
> Queued these, thanks.
> 
> Have you done the work on contrib/**.py already, or should I tackle
> that? Either way is fine.

Not yet. Feel free to beat me. ;)

Patch

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
@@ -141,6 +141,15 @@  here that we should still endeavor to fi
 hidden by deduplication algorithm in the cycle detector, so fixing
 these may expose other cycles.
 
-  $ hg locate 'mercurial/**.py' 'hgext/**.py' | sed 's-\\-/-g' | python "$import_checker" -
+Known-bad files are excluded by -X as some of them would produce unstable
+outputs, which should be fixed later.
+
+  $ hg locate 'mercurial/**.py' 'hgext/**.py' 'tests/**.py' \
+  > -X tests/test-hgweb-auth.py \
+  > -X tests/hypothesishelpers.py \
+  > -X tests/test-ctxmanager.py \
+  > -X tests/test-lock.py \
+  > -X tests/test-verify-repo-operations.py \
+  > | sed 's-\\-/-g' | python "$import_checker" -
   Import cycle: hgext.largefiles.basestore -> hgext.largefiles.localstore -> hgext.largefiles.basestore
   [1]