Mercurial > hg-stable
changeset 28475:ae522fb493d4
test: make check-py3-compat.py ignore empty code more reliably
It couldn't exclude an empty file containing comments. That's why
hgext/__init__.py had been listed in test-check-py3-compat.t before
"hgext: officially turn 'hgext' into a namespace package".
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 11 Mar 2016 10:26:58 +0900 |
parents | 00e6e0d0bfeb |
children | e28dc6de38e7 |
files | contrib/check-py3-compat.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/check-py3-compat.py Fri Mar 11 22:30:43 2016 +0800 +++ b/contrib/check-py3-compat.py Fri Mar 11 10:26:58 2016 +0900 @@ -16,12 +16,12 @@ """Check Python 3 compatibility for a file.""" with open(f, 'rb') as fh: content = fh.read() + root = ast.parse(content) # Ignore empty files. - if not content.strip(): + if not root.body: return - root = ast.parse(content) futures = set() haveprint = False for node in ast.walk(root):