Mercurial > public > mercurial-scm > hg-stable
diff tests/test-demandimport.py @ 43076:2372284d9457
formatting: blacken the codebase
This is using my patch to black
(https://github.com/psf/black/pull/826) so we don't un-wrap collection
literals.
Done with:
hg files 'set:**.py - mercurial/thirdparty/** - "contrib/python-zstandard/**"' | xargs black -S
# skip-blame mass-reformatting only
# no-check-commit reformats foo_bar functions
Differential Revision: https://phab.mercurial-scm.org/D6971
author | Augie Fackler <augie@google.com> |
---|---|
date | Sun, 06 Oct 2019 09:45:02 -0400 |
parents | 30248d6bc057 |
children | c5e0a9b97b8a |
line wrap: on
line diff
--- a/tests/test-demandimport.py Sat Oct 05 10:29:34 2019 -0400 +++ b/tests/test-demandimport.py Sun Oct 06 09:45:02 2019 -0400 @@ -1,6 +1,7 @@ from __future__ import absolute_import, print_function from mercurial import demandimport + demandimport.enable() import os @@ -12,8 +13,9 @@ ispy3 = sys.version_info[0] >= 3 # Only run if demandimport is allowed -if subprocess.call(['python', '%s/hghave' % os.environ['TESTDIR'], - 'demandimport']): +if subprocess.call( + ['python', '%s/hghave' % os.environ['TESTDIR'], 'demandimport'] +): sys.exit(80) # We rely on assert, which gets optimized out. @@ -33,8 +35,11 @@ if os.name != 'nt': try: import distutils.msvc9compiler - print('distutils.msvc9compiler needs to be an immediate ' - 'importerror on non-windows platforms') + + print( + 'distutils.msvc9compiler needs to be an immediate ' + 'importerror on non-windows platforms' + ) distutils.msvc9compiler except ImportError: pass @@ -42,6 +47,8 @@ import re rsub = re.sub + + def f(obj): l = repr(obj) l = rsub("0x[0-9a-fA-F]+", "0x?", l) @@ -49,6 +56,7 @@ l = rsub("'<[a-z]*>'", "'<whatever>'", l) return l + demandimport.disable() os.environ['HGDEMANDIMPORT'] = 'disable' # this enable call should not actually enable demandimport!