Mercurial > hg
annotate tests/test-check-pyflakes.t @ 23352:5bd04faaa3ee
run-tests: don't warn on unnecessary globs mandated by check-code.py
When test output is processed, if os.altsep is defined (i.e. on Windows),
TTest.globmatch() will cause a warning later on if a line has a glob that isn't
necessary. Unfortunately, the regex checking in check-code.py doesn't have this
context. Therefore we ended up with cases where the test would get flagged with
a warning only on Windows because a glob was present, because check-code.py
would warn if it wasn't. For example, from test-subrepo.t:
$ hg -R issue1852a push `pwd`/issue1852c
pushing to $TESTTMP/issue1852c (glob)
The glob isn't necessary here because the slash is shown as it was provided.
However, check-code mandates one to handle the case where the default path has
backslashes in it.
Break the cycle by checking against a subset of the check-code rules before
flagging the test with a warning, and ignore the superfluous glob if it matches
a rule. This change fixes warnings in test-largefiles-update.t, test-subrepo.t,
test-tag.t, and test-rename-dir-merge.t on Windows.
I really hate that the rules are copy/pasted here (minus the leading two spaces)
because it would be nice to only update the rules once, in a single place. But
I'm not sure how else to do it. I'm open to suggestions. Splitting some of the
rules out of check-code.py seems wrong, but so does moving check-code.py out of
contrib, given that other checking scripts live there.
There are other glob patterns that could be copied over, but this is enough to
make the current tests run on Windows.
author | Matt Harbison <matt_harbison@yahoo.com> |
---|---|
date | Tue, 18 Nov 2014 22:02:00 -0500 |
parents | 77142de48ae4 |
children | aef5b606d3ee |
rev | line source |
---|---|
22047
8fb6844a4ff1
tests: change some #ifs to #requires
Matt Mackall <mpm@selenic.com>
parents:
21293
diff
changeset
|
1 #require test-repo pyflakes |
21208
0e1cbd3d52f7
tests: add repository check for pyflakes test
Matt Mackall <mpm@selenic.com>
parents:
20644
diff
changeset
|
2 |
16350
4f795f5fbb0b
tests: make tests work if directory contains special characters
Thomas Arendsen Hein <thomas@intevation.de>
parents:
15372
diff
changeset
|
3 $ cd "`dirname "$TESTDIR"`" |
19377
0cb996ee8c6d
tests: run pyflakes on files from manifest which could be python files
Simon Heimberg <simohe@besonet.ch>
parents:
16350
diff
changeset
|
4 |
0cb996ee8c6d
tests: run pyflakes on files from manifest which could be python files
Simon Heimberg <simohe@besonet.ch>
parents:
16350
diff
changeset
|
5 run pyflakes on all tracked files ending in .py or without a file ending |
0cb996ee8c6d
tests: run pyflakes on files from manifest which could be python files
Simon Heimberg <simohe@besonet.ch>
parents:
16350
diff
changeset
|
6 (skipping binary file random-seed) |
21208
0e1cbd3d52f7
tests: add repository check for pyflakes test
Matt Mackall <mpm@selenic.com>
parents:
20644
diff
changeset
|
7 |
21221
e3ca21e4d05f
tests: use locate to find files for pyflakes check
Matt Mackall <mpm@selenic.com>
parents:
21208
diff
changeset
|
8 $ hg locate 'set:**.py or grep("^!#.*python")' 2>/dev/null \ |
19377
0cb996ee8c6d
tests: run pyflakes on files from manifest which could be python files
Simon Heimberg <simohe@besonet.ch>
parents:
16350
diff
changeset
|
9 > | xargs pyflakes 2>/dev/null | "$TESTDIR/filterpyflakes.py" |
21293
507ce509fd22
filterpyflakes: make memoryview filtering unconditional
Matt Mackall <mpm@selenic.com>
parents:
21271
diff
changeset
|
10 tests/filterpyflakes.py:58: undefined name 'undefinedname' |
22053
4354b1e35f53
tests: fix pyflakes test whitespace breakage
Matt Mackall <mpm@selenic.com>
parents:
22047
diff
changeset
|
11 |
4354b1e35f53
tests: fix pyflakes test whitespace breakage
Matt Mackall <mpm@selenic.com>
parents:
22047
diff
changeset
|
12 |