[issue13473] Add tests for files byte-compiled by distutils[2]

Nick Coghlan report at bugs.python.org
Thu Apr 26 03:38:16 CEST 2012


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Your basic approach looks sensible to me.

One trick I use in test_cmd_line_script to prevent recreation is to simply delete the source file. If the source is gone, implicit recreation is impossible. Unfortunately, that doesn't work for __pycache__, since the cached version will be ignored if the original goes missing.

One useful explicit check (as per #14443) would be to ensure the magic number and other attributes are as expected:
http://hg.python.org/cpython/file/57d558f1904d/Lib/importlib/_bootstrap.py#l444

You can also pass the "-B" flag to your testing subprocesses, which will switch off the implicit bytecode generation.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13473>
_______________________________________


More information about the Python-bugs-list mailing list