This plugin provides a simple way to save data files (specifically .npy files) after a test has failed in nosetests, and to delete those files when the test passes. I use it for simple debugging, to save data from failing tests.
To use the postmortem plugin, you must enable it with the command-line option --with-postmortem. Then, it will inspect test instances for a POST_SAVE variable. The plugin uses class isntances as a way to save the variables after the test function has finished. It does nothing for non-class instance.
The POST_SAVE variable should be a list containing tuples. The tuples are pairs of (data, filename) which will be saved. Filenames which end with .npy will be saved using np.save(). .dat will be saved with np.savetxt(). Other extensions will be written as strings to text files.
A list of all the files saved will be saved using the format <test_id>.txt in the same folder. This list is used by PostMortemScript to load saved files.
A script for managing post-mortem data.
Set the class variables test_ids or module_ids to load test data. Then access test data during the do() method using the test_data configuration object.
The test IDs to search for in the postmortem area.
The module IDs to search for in the postmortem area. Module IDs search for any test which matches <module>.*.txt .
The data loaded for this test. A dictionary mapping file ids to data. The file id is just test_id + filename