Commit Graph

12 Commits

Author SHA1 Message Date
Jun Wu
584656dff3 codemod: join the auto-formatter party
Summary:
Turned on the auto formatter. Ran `arc lint --apply-patches --take BLACK **/*.py`.
Then run `arc lint` again so some other autofixers like spellchecker etc. looked
at the code base. Manually accept the changes whenever they make sense, or use
a workaround (ex. changing "dict()" to "dict constructor") where autofix is false
positive. Disabled linters on files that are hard (i18n/polib.py) to fix, or less
interesting to fix (hgsubversion tests), or cannot be fixed without breaking
OSS build (FBPYTHON4).

Conflicted linters (test-check-module-imports.t, part of test-check-code.t,
test-check-pyflakes.t) are removed or disabled.

Duplicated linters (test-check-pyflakes.t, test-check-pylint.t) are removed.

An issue of the auto-formatter is lines are no longer guarnateed to be <= 80
chars. But that seems less important comparing with the benefit auto-formatter
provides.

As we're here, also remove test-check-py3-compat.t, as it is currently broken
if `PYTHON3=/bin/python3` is set.

Reviewed By: wez, phillco, simpkins, pkaush, singhsrb

Differential Revision: D8173629

fbshipit-source-id: 90e248ae0c5e6eaadbe25520a6ee42d32005621b
2018-05-25 22:17:29 -07:00
Matt Harbison
b2d78bc596 run-tests: accept '\' vs '/' path differences without '(glob)'
Having to constantly adjust these is a hassle.  It's easy for this to slip by
when not testing on Windows, and then when it happens on stable, the tests fail
for the next 3 months if we follow the rules for stable.

This works the same way the EOL differences are ignored, namely to adjust on the
fly and recheck on Windows.  I can't think of any situation where there would be
a '\' on Windows, a '/' elsewhere, and the '/' should be considered a failure on
Windows.

This fixes the obvious output problems where (glob) is missing.  Without this,
test-alias.t, test-remotenames.t and test-largefiles-misc.t are failing.  The
flip side (not handled by this) is the case where an unnecessary glob is
present.  There seems to be two separate behaviors.  f3517e22bfa1 is an example
of where the test has been autocorrecting (with output differences), and
ed159a9fcf2a is an example where the test fails and reports 'no result code from
test'.  Hopefully those cases will become even more rare if people don't need to
guess at when a glob is needed for a Windows path.

It's probably unreasonable to submit a single patch that wipes out all of the
(glob) instances that were only used to hide path differences, given the churn
from other contributors.  Since their presence isn't harming the tests, these
can be removed through attrition.
2017-12-10 00:16:11 -05:00
Matt Harbison
1a1aaf5b24 run-tests: suggest a (glob) for os.path.sep mismatches with '\r\n' EOL too
We already do this for lines ending in '\n', such that the test only needs to be
run with --interactive and the changes accepted at the end.  But that wasn't
working with list-tree.py output for example, and required manual fixup.
2017-12-10 00:00:36 -05:00
Augie Fackler
fe8bb86ad9 tests: fix up test-run-tests failures on Python 3.6
Some of the recent work on run-tests.py didn't work on Python 3. This
fixes the regressions.

Differential Revision: https://phab.mercurial-scm.org/D270
2017-08-08 15:07:05 -04:00
Matt Harbison
72e29cff86 run-tests: drop required (feature !) style lines when the output is missing
Essentially, these were acting as a verbose (?) flag, since they weren't being
dropped when required.  Foozy has a nice description [1].  Basically, a couple
more places needed to check the features before treating it as optional.

I don't like how test-run-tests.py had to be hacked, but _hghave() can't be made
a static method.  The test change was a change while developing `debugssl`,
prior to tightening up the cases where the message is printed, that this fix
would have caught.

[1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2017-July/101941.html
2017-07-18 00:12:44 -04:00
Pulkit Goyal
013ab712f9 tests: make test-run-tests use absolute_import 2016-04-14 01:03:24 +05:30
Augie Fackler
5ee3ad0b23 test-run-tests: fix for Python 3.5
This test now passes in both 3.5 and 2.6.
2015-04-14 10:57:15 -04:00
Gregory Szorc
19099dc4f1 run-tests: make linematch a static method of TTest
linematch only applies to t tests. It makes sense to move everything t
test related to the TTest class.
2014-04-19 16:11:49 -07:00
Simon Heimberg
3668dbc539 tests: fix test-run-tests.py on OS X
Do the same hack as in test-doctests.py to let the test pass on OS X.
2014-01-17 12:46:29 +01:00
Simon Heimberg
14f515afb4 run-tests: print more information on unnecessary glob matching
Extend the message with the test name and the approximate line number. (The
line number is the one of the command producing the output.)
Finding the line to fix is easier now.

old message:
......
Info, unnecessary glob: at a/b/c (glob)
..

new message:
......
Info, unnecessary glob in test-example.t (after line 9): at a/b/c (glob)
..


The test result is still pass as before.
2014-01-16 12:08:57 +01:00
Simon Heimberg
2967b15687 run-tests: suggest to append glob when only path sep does not match
When the line does not match because of \ instead of / (on windows), append
(glob) in the expected output.
This allows to rename test-bla.t.err to test-bla.t for getting a correct
output. This worked for other failures like missing (esc), but not here.

  Output example (only +- lines of diff):
Before:
-  path/with/local/sep
+  path\\with\\local/sep
Now:
-  path/with/local/sep
+  path/with/local/sep (glob)
2014-01-16 12:08:29 +01:00
Simon Heimberg
3c3ef48a08 tests: new test for line matching functions in run-tests
Test for failing matches and warnings. (The existing test-run-tests.t can not
do both by design.) And simulate matching on other os.
2014-01-16 19:07:18 +01:00