##// END OF EJS Templates
tests: verify that Python scripts are blackened...
Gregory Szorc -
r44090:2d8d4e08 default
parent child Browse files
Show More
@@ -1,5 +1,5 b''
1 #require black
1 #require black
2
2
3 $ cd $RUNTESTDIR/..
3 $ cd $RUNTESTDIR/..
4 $ black --config=black.toml --check --diff `hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"'`
4 $ black --config=black.toml --check --diff `hg files 'set:(**.py + grep("^#!.*python")) - mercurial/thirdparty/** - "contrib/python-zstandard/**"'`
5
5
@@ -1,25 +1,26 b''
1 #require test-repo
1 #require test-repo
2
2
3 $ . "$TESTDIR/helpers-testrepo.sh"
3 $ . "$TESTDIR/helpers-testrepo.sh"
4 $ cd "`dirname "$TESTDIR"`"
4 $ cd "`dirname "$TESTDIR"`"
5
5
6 look for python scripts that do not use /usr/bin/env
6 look for python scripts that do not use /usr/bin/env
7
7
8 $ testrepohg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bi{1}n/env python") - **/*.t'
8 $ testrepohg files 'set:grep(r"^#!.*?python") and not grep(r"^#!/usr/bi{1}n/env python") - **/*.t'
9 [1]
9 [1]
10
10
11 In tests, enforce $PYTHON and *not* /usr/bin/env python or similar:
11 In tests, enforce $PYTHON and *not* /usr/bin/env python or similar:
12 $ testrepohg files 'set:grep(r"#!.*?python") and **/*.t' \
12 $ testrepohg files 'set:grep(r"#!.*?python") and **/*.t' \
13 > -X tests/test-check-execute.t \
13 > -X tests/test-check-execute.t \
14 > -X tests/test-check-format.t \
14 > -X tests/test-check-module-imports.t \
15 > -X tests/test-check-module-imports.t \
15 > -X tests/test-check-pyflakes.t \
16 > -X tests/test-check-pyflakes.t \
16 > -X tests/test-check-shbang.t
17 > -X tests/test-check-shbang.t
17 [1]
18 [1]
18
19
19 The above exclusions are because they're looking for files that
20 The above exclusions are because they're looking for files that
20 contain Python but don't end in .py - please avoid adding more.
21 contain Python but don't end in .py - please avoid adding more.
21
22
22 look for shell scripts that do not use /bin/sh
23 look for shell scripts that do not use /bin/sh
23
24
24 $ testrepohg files 'set:grep(r"^#!.*/bi{1}n/sh") and not grep(r"^#!/bi{1}n/sh")'
25 $ testrepohg files 'set:grep(r"^#!.*/bi{1}n/sh") and not grep(r"^#!/bi{1}n/sh")'
25 [1]
26 [1]
General Comments 0
You need to be logged in to leave comments. Login now