##// END OF EJS Templates
tests: enforce the use of `from __future__ import annotations`...
Matt Harbison -
r53246:662b08ac default
parent child Browse files
Show More
@@ -1,45 +1,52
1 #require test-repo hg32
1 #require test-repo hg32
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ import_checker="$TESTDIR"/../contrib/import-checker.py
4 $ import_checker="$TESTDIR"/../contrib/import-checker.py
5
5
6 $ cd "$TESTDIR"/..
6 $ cd "$TESTDIR"/..
7
7
8 There are a handful of cases here that require renaming a module so it
8 There are a handful of cases here that require renaming a module so it
9 doesn't overlap with a stdlib module name. There are also some cycles
9 doesn't overlap with a stdlib module name. There are also some cycles
10 here that we should still endeavor to fix, and some cycles will be
10 here that we should still endeavor to fix, and some cycles will be
11 hidden by deduplication algorithm in the cycle detector, so fixing
11 hidden by deduplication algorithm in the cycle detector, so fixing
12 these may expose other cycles.
12 these may expose other cycles.
13
13
14 Known-bad files are excluded by -X as some of them would produce unstable
14 Known-bad files are excluded by -X as some of them would produce unstable
15 outputs, which should be fixed later.
15 outputs, which should be fixed later.
16
16
17 NOTE: the `hg files` command here only works on files that are known to
17 NOTE: the `hg files` command here only works on files that are known to
18 Mercurial. If you add an import of a new file and haven't yet `hg add`ed it, you
18 Mercurial. If you add an import of a new file and haven't yet `hg add`ed it, you
19 will likely receive warnings about a direct import.
19 will likely receive warnings about a direct import.
20
20
21 $ testrepohg files 'set:**.py or grep(r"^#!.*?python")' \
21 $ testrepohg files 'set:**.py or grep(r"^#!.*?python")' \
22 > 'glob:tests/**.t' \
22 > 'glob:tests/**.t' \
23 > -X hgweb.cgi \
23 > -X hgweb.cgi \
24 > -X setup.py \
24 > -X setup.py \
25 > -X contrib/automation/ \
25 > -X contrib/automation/ \
26 > -X contrib/debugshell.py \
26 > -X contrib/debugshell.py \
27 > -X contrib/hgweb.fcgi \
27 > -X contrib/hgweb.fcgi \
28 > -X contrib/packaging/hg-docker \
28 > -X contrib/packaging/hg-docker \
29 > -X contrib/packaging/hgpackaging/ \
29 > -X contrib/packaging/hgpackaging/ \
30 > -X contrib/packaging/inno/ \
30 > -X contrib/packaging/inno/ \
31 > -X contrib/phab-clean.py \
31 > -X contrib/phab-clean.py \
32 > -X contrib/python-zstandard/ \
32 > -X contrib/python-zstandard/ \
33 > -X contrib/win32/hgwebdir_wsgi.py \
33 > -X contrib/win32/hgwebdir_wsgi.py \
34 > -X contrib/perf-utils/perf-revlog-write-plot.py \
34 > -X contrib/perf-utils/perf-revlog-write-plot.py \
35 > -X doc/gendoc.py \
35 > -X doc/gendoc.py \
36 > -X doc/hgmanpage.py \
36 > -X doc/hgmanpage.py \
37 > -X i18n/posplit \
37 > -X i18n/posplit \
38 > -X mercurial/thirdparty \
38 > -X mercurial/thirdparty \
39 > -X tests/hypothesishelpers.py \
39 > -X tests/hypothesishelpers.py \
40 > -X tests/test-check-interfaces.py \
40 > -X tests/test-check-interfaces.py \
41 > -X tests/test-demandimport.py \
41 > -X tests/test-demandimport.py \
42 > -X tests/test-imports-checker.t \
42 > -X tests/test-imports-checker.t \
43 > -X tests/test-verify-repo-operations.py \
43 > -X tests/test-verify-repo-operations.py \
44 > -X tests/test-extension.t \
44 > -X tests/test-extension.t \
45 > | sed 's-\\-/-g' | "$PYTHON" "$import_checker" -
45 > | sed 's-\\-/-g' | "$PYTHON" "$import_checker" -
46
47 All files that get type checked must have 'from __future__ import annotations'
48
49 $ testrepohg files 'set:**.py and size(">0")' -I mercurial -I hgext -X mercurial/thirdparty -0 \
50 > | xargs -0 grep -L '^from __future__ import annotations$'
51 mercurial/cmd_impls/graft.py
52 mercurial/testing/ps_util.py
General Comments 0
You need to be logged in to leave comments. Login now