# HG changeset patch # User Yuya Nishihara # Date 2016-03-11 01:26:58 # Node ID ae522fb493d41c5147ff5399b033bc3ff93c6445 # Parent 00e6e0d0bfeb049b797215f9c2436d7edbb41fda 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". diff --git a/contrib/check-py3-compat.py b/contrib/check-py3-compat.py --- a/contrib/check-py3-compat.py +++ b/contrib/check-py3-compat.py @@ -16,12 +16,12 @@ def check_compat(f): """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):