##// END OF EJS Templates
tests: enforce the use of `from __future__ import annotations`...
tests: enforce the use of `from __future__ import annotations` A recent MR and a separate recently landed MR that extracted code to a new file overlooked this, so I think it's worth flagging to ensure consistency. We don't enforce the import for empty files (like `__init__.py`). I'd rather this go into `import-checker.py`, but the import of interest only happens at the top of the file, and its `verify_modern_convention()` calls itself recursively as it transits the AST where the annotations might be. After a few hours of hacking on trying to get it to enforce the import, but only if annotations are used in the module (we generally don't have or check annotations in test files, so don't need this import), I gave up and resorted to this. It won't handle multi-line imports, but this isn't something I'd expect to change often, so this is good enough for now.

File last commit:

r52757:1c5810ce default
r53246:662b08ac default
Show More
__main__.py
15 lines | 252 B | text/x-python | PythonLexer
Matt Harbison
typing: add `from __future__ import annotations` to remaining source files...
r52757 from __future__ import annotations
Jason R. Coombs
library: incorporate demandimport into runpy invocation
r51590 def run():
from . import demandimport
with demandimport.tracing.log('hg script'):
demandimport.enable()
from . import dispatch
dispatch.run()
Jason R. Coombs
library: enable runpy invocation on mercurial package
r51589 if __name__ == '__main__':
Jason R. Coombs
library: incorporate demandimport into runpy invocation
r51590 run()