[PATCH] tests: fix import order in test-bdiff
Gregory Szorc
gregory.szorc at gmail.com
Thu Jan 12 23:59:24 EST 2017
On Wed, Jan 11, 2017 at 5:36 PM, Martin von Zweigbergk <
martinvonz at google.com> wrote:
> On Wed, Jan 11, 2017 at 4:48 PM, Gregory Szorc <gregory.szorc at gmail.com>
> wrote:
> > 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.
>
> So test-verify-repo-operations.py, test-manifest.py and test-lock.py
> are also incorrect in that case?
>
They look incorrect to me w.r.t. silenttestrunner being in the stdlib
block. test-verify-repo-operations.py is also not even close to using our
import convention, which is why it is excluded by
test-check-module-imports.t.
>
> >
> > 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?
>
> Nope, it fails.
>
I still can't reproduce your failure.
If I run the import checker manually, I do get a different failure:
$ echo tests/test-bdiff.py | python contrib/import-checker.py -
tests/test-bdiff.py:8: direct symbol import bdiff, mpatch from mercurial
And if I run a command inspired from test-check-module-imports.t:
$ hg locate 'set:**.py or grep(r"^#!.*?python")' 'tests/**.t' | python
contrib/import-checker.py -
I don't see a failure for test-bdiff.py. Wat.
I have a hunch import-checker.py is doing something wonky when processing
multiple files.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170112/f0f06dd0/attachment.html>
More information about the Mercurial-devel
mailing list