kNose
the Komodo IDE/Edit extension for Python unit testing
kNose is my attempt to make Python unit testing in Komodo as simple as
possible. It's a GUI front-end for the excellent nose framework written
by Jason Pellerin.
Features:
- First-class integration into Komodo, your Python IDE of
choice. (You are using it, aren't you?)
- Run tests manually or automatically.
- Green/red bar, plus a tree view, informs you of
the status of your tests.
- Ability to jump straight to a failing test at the offending
line number.
- All exception traceback information available for debugging.
Downloads
- nose
version 0.10.1 by Jason Pellerin, available from the Python Package Index.
Note: The
nose libraries must
be installed into the default Python interpreter that Komodo uses for
its autocompletion/shell/etc. You can verify this by going into
Komodo's Edit menu, clicking Preferences, choosing the Languages:
Python category and looking at the Default Python Interpreter combo box.
- kNose 1.1.3 - Released May 9, 2008 (Extension tested with Windows
NT SP2 and Linux Mint Cassandra.)
Requirements
Komodo IDE or Komodo Edit,
version 4.2 or higher.
Installation
- To install nose, follow the instructions on the project
page.
- Start Komodo.
- Drop down the Tools menu, click on "Extension
Manager",
click on the Install button, and browse to find and load the knose.xpi
on your system. Alternatively, you can drag the knose.xpi file
onto the Komodo editor window.
Features and usage
Tests tab
All of kNose's features
are accessed via the Tests tab on Komodo's left pane (also
where the Projects tab is located).
The "Auto-test" checkbox, when checked, runs unit tests automatically
every time a project file is saved. When "Auto-test" is unchecked, the
"Run tests" button becomes enabled, and you must click this button
manually each time you want your unit tests to be run.
The color bar will turn red if any tests result in errors or failures,
and the bar will turn green when all tests pass.
The number of tests that pass, fail or give errors is counted below the
color bar.
Hovering over a test method in the tree list will display a tooltip
that shows the exception traceback (if any). Also, double-clicking a
method that has a test failure or error will open the
file
and jump to the offending line.
NEW: kNose now features a statusbar icon that displays whether tests pass or fail even when the project pane is hidden.
Unit testing discovery
kNose will
scan all the URIs in your active project, looking for the word
'test' in either the directory path or the filename. (This is to reduce
the number of files passed to nose, since a Live Folder or other
project structure with many files can cause nose to run
very slowly.) The URIs that pass the check above get passed into nose,
and nose runs them
according
to its own rules.
If kNose doesn't find any tests to run in your project,
it will display a message saying "No tests were found." Hovering over this message will
bring up a tooltip with debugging information that may help you understand what is going wrong.
If you submit a bug report to me (see below), it will be helpful to include this information in the report.
Change list
Version 1.1.3:
- Changed from error log text files to using Python's logging API
- Skipping __init__.py files before they are processed as these were causing tests to run twice.
- Changed regex for parsing to be more robust (thanks to Christoph Zwerschke)
- Created new statusbar icon that displays test status, using Renato Raver's code in the Komodo TODO extension as an example.
Version 1.1.2:
- Added extensions.knose namespace to knose.js to avoid conflicts
with other Komodo extensions. This was a known problem with the
sourcetree extension.
Version 1.1.1:
- Changed environment variables so nosetests is found along
user's PATH. The old method of specifying its direct location on the
file system seemed to give nose some problems when locating unit tests
in certain directories. Finicky, finicky. :)
- Added a message in the test window if nose cannot find any
tests in your project. Hovering over the message displays a tooltip
with the arguments and environment variables passed to the subprocess
call so that I can more easily debug any problems on users' systems.
Version 1.1:
- Added -v option when calling out to nose so that verbose output is returned in all cases, and parsing works correctly.
- Scan URIs for the word 'test' before they are passed to nose to increase speed and avoid additional confusion in parsing.
- Changed parsing for test names to use regular expressions for speed and more robust behavior.
- Improved parsing to handle classes derived from unittest.TestCase correctly.
Version 1.0:
Licensing
Bug reports/Feature requests
Misc. notes
kNose is still pretty basic so far, so
there's no support yet
for other nose plugins. kNose 1.2 will use the nose 0.10 plugin
API and support plugins that way, but I can't promise when this will be
finished.
I haven't tested kNose on a Mac yet, because I don't own one. Which
probably means there will be issues, but I can't test them anyway. If
you can do some Mac testing and fixing, however, I'll try and include
any patches you come up with as long as it doesn't break any other
functionality.
-- Brandon Corfman, updated 05/09/2008