Mercurial > hg
changeset 43095:fb41ea2ea076
formatting: introduce a `test-check-format-black.t` that enforce formatting
This should prevent use to drift away from the expect format.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Mon, 07 Oct 2019 11:52:58 -0400 |
parents | e8cf9ad52a78 |
children | 813aa8cc55d4 |
files | tests/hghave.py tests/test-check-format.t |
diffstat | 2 files changed, 19 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/hghave.py Mon Oct 07 10:58:51 2019 -0400 +++ b/tests/hghave.py Mon Oct 07 11:52:58 2019 -0400 @@ -1,4 +1,4 @@ -from __future__ import absolute_import +from __future__ import absolute_import, print_function import os import re @@ -972,3 +972,14 @@ # 24.4, so we allow emacs 24.4, 24.5, and 25+ (24.5 was the last # 24 release) return matchoutput('emacs --version', b'GNU Emacs 2(4.4|4.5|5|6|7|8|9)') + + +# @check('black', 'the black formatter for python') +@check('grey', 'grey, the fork of the black formatter for python') +def has_black(): + # use that to actual black as soon as possible + # blackcmd = b'black --version' + blackcmd = b'python3 $RUNTESTDIR/../contrib/grey.py --version' + # version_regex = b'black, version \d' + version_regex = b'grey.py, version \d' + return matchoutput(blackcmd, version_regex)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/test-check-format.t Mon Oct 07 11:52:58 2019 -0400 @@ -0,0 +1,7 @@ +#require grey + +(this should use the actual black as soon as possible) + + $ cd $RUNTESTDIR/.. + $ python3 contrib/grey.py -S --quiet --check --diff `hg files 'set:**.py - hgext/fsmonitor/pywatchman/** - mercurial/thirdparty/** - "contrib/python-zstandard/**" - contrib/grey.py'` +