~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/testing.txt

  • Committer: Martin Pool
  • Date: 2010-07-15 09:47:16 UTC
  • mfrom: (5345 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5346.
  • Revision ID: mbp@canonical.com-20100715094716-sljdg6go0d12xi79
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
905
905
Please see bzrlib.treebuilder for more details.
906
906
 
907
907
 
 
908
Temporarily changing state
 
909
~~~~~~~~~~~~~~~~~~~~~~~~~~
 
910
 
 
911
If your test needs to temporarily mutate some global state, and you need
 
912
it restored at the end, you can say for example::
 
913
 
 
914
    self.overrideAttr(osutils, '_cached_user_encoding', 'latin-1')
 
915
 
 
916
Cleaning up
 
917
~~~~~~~~~~~
 
918
 
 
919
Our base ``TestCase`` class provides an ``addCleanup`` method, which
 
920
should be used instead of ``tearDown``.  All the cleanups are run when the
 
921
test finishes, regardless of whether it passes or fails.  If one cleanup
 
922
fails, later cleanups are still run.
 
923
 
 
924
(The same facility is available outside of tests through
 
925
``bzrlib.cleanup``.)
 
926
 
 
927
 
908
928
Manual testing
909
929
==============
910
930