[PATCH] tests: fix import order in test-bdiff

Gregory Szorc gregory.szorc at gmail.com
Wed Jan 11 19:48:04 EST 2017


On Wed, Jan 11, 2017 at 12:58 PM, Martin von Zweigbergk via Mercurial-devel
<mercurial-devel at mercurial-scm.org> wrote:

> # HG changeset patch
> # User Martin von Zweigbergk <martinvonz at google.com>
> # Date 1484168228 28800
> #      Wed Jan 11 12:57:08 2017 -0800
> # Node ID 193e2d6cba6f294dca88b939a2a1afa5874a9794
> # Parent  9823e2f50a935f6170e01235b65b5282680ebdab
> tests: fix import order in test-bdiff
>
> Without this, I see the following failure in
> test-check-module-imports.t.
>
> @@ -180,3 +180,5 @@
>    > -X tests/test-hgweb-no-request-uri.t \
>    > -X tests/test-hgweb-non-interactive.t \
>    > | sed 's-\\-/-g' | python "$import_checker" -
> +  tests/test-bdiff.py:6: imports not lexically sorted: silenttestrunner <
> unittest
> +  [1]
>
> diff -r 9823e2f50a93 -r 193e2d6cba6f tests/test-bdiff.py
> --- a/tests/test-bdiff.py       Sun Jan 08 00:52:54 2017 +0800
> +++ b/tests/test-bdiff.py       Wed Jan 11 12:57:08 2017 -0800
> @@ -1,10 +1,9 @@
>  from __future__ import absolute_import, print_function
>  import collections
> +import silenttestrunner
>  import struct
>  import unittest
>
> -import silenttestrunner
> -
>  from mercurial import (
>      bdiff,
>      mpatch,
>

Hmmm. This is seemingly a bug in the import checker because
silenttestrunner is not part of the Python standard library.

But, uh, I can't reproduce this failure. If I had to take a guess, it would
be that you have a silenttestrunner module installed in your Python install
and that is confusing the import checker into believing it is part of the
stdlib. Does `import silenttestrunner` work from a Python REPL on your
machine?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170111/be6f7439/attachment.html>


More information about the Mercurial-devel mailing list