unit test generator for Python
Easiest way to get Pythoscope is via setuptools:
$ easy_install pythoscope
You can also download a source package from http://pythoscope.org/local–files/download/pythoscope-0.2.2.tar.gz. or get a copy of a development branch using bazaar:
bzr branch lp:pythoscope
You can use the tool through a single pythoscope command. To analyze one of your projects, type:
$ pythoscope inspect path/to/your/project/
It’s only doing static analysis, and doesn’t import your modules or execute your code in any way, so you’re perfectly safe to run it on anything you want. After that, a file named .pythoscope will be created in the current directory. To generate test stubs based on your project, select files you want to generate tests for:
$ pythoscope generate path/to/your/project/specific/file.py path/to/your/project/other/*.py
Test files will be saved into pythoscope-tests/ directory. Test cases are aggregated into TestCase classes. Currently each production class and each production function gets its own TestCase class.
Some of the classes and functions are ignored by the generator - all which name begins with an underscore, exception classes, and some others.
Generator itself is configurable to some extent, see:
$ pythoscope generate --help
for more information on available options.
All Pythoscope source code is licensed under an MIT license (see LICENSE file). All files under lib2to3/ are licensed under PSF license.
- Fixed the inner classes bug (#260924).
- Collector appends new data to .pythoscope file instead of overwriting it.
- Test modules are being analyzed as well.
- Using lib2to3 for static code analysis instead of stdlib’s compiler module.
- Generator can append test cases to existing test modules. Preserves comments and original whitespace.
- Cheetah is no longer a dependency.
- Renamed ‘collect’ command to ‘inspect’.
Contains a packaging bug fix, which prevented users from using the tests cases generator and running internal pythoscope tests.
First release, featuring static code analysis and generation of test stubs.