[New-bugs-announce] [issue13447] Add tests for Tools/scripts/reindent.py

Éric Araujo report at bugs.python.org
Mon Nov 21 18:08:04 CET 2011

New submission from Éric Araujo <merwok at netwok.org>:

When people find bugs in reindent.py (#12930 is a recent one), we have to try to reproduce the bug manually, apply a fix and test manually again.  The alternative is to only read the code and trust that it works.  I find both of these positions unsatisfactory and propose to add unit tests for the script.  I’m opening this report to gather votes, and if they’re positive I’ll proceed with a patch and other bug reports for the other most used scripts (we have a number of reports for pygettext and msgfmt for example; I am not proposing adding tests for all, or even most, scripts).

Even if these scripts are not part of the stdlib and not officially documented or supported, we do ship them and use them (reindent from patchcheck and Mercurial hooks for example), so I really think we need unit tests to know that they work as intended.  Then we’ll be able to commit fixes and other changes serenely.

Implementation idea: The tests would go in Tools/scripts/tests/test_reindent.py and a short file in Lib/test/test_scripts.py would run them as part of the test suite if they exist (so that running tests from an installed Python without Tools dir just skips test_scripts).  For scripts that are in another Tools subdir, like Tools/i18n/pygettext.py, I’d put them in Tools/i18n/tests/test_pygettext.py.

components: Demos and Tools, Tests
messages: 148062
nosy: eric.araujo
priority: normal
severity: normal
status: open
title: Add tests for Tools/scripts/reindent.py
versions: Python 2.7, Python 3.2, Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list