/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to doc/developers/testing.txt

MergeĀ lp:bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
329
329
We make selective use of doctests__.  In general they should provide
330
330
*examples* within the API documentation which can incidentally be tested.  We
331
331
don't try to test every important case using doctests |--| regular Python
332
 
tests are generally a better solution.  That is, we just use doctests to
333
 
make our documentation testable, rather than as a way to make tests.
 
332
tests are generally a better solution.  That is, we just use doctests to make
 
333
our documentation testable, rather than as a way to make tests. Be aware that
 
334
doctests are not as well isolated as the unit tests, if you need more
 
335
isolation, you're likely want to write unit tests anyway if only to get a
 
336
better control of the test environment.
334
337
 
335
338
Most of these are in ``bzrlib/doc/api``.  More additions are welcome.
336
339
 
977
980
 
978
981
    self.overrideAttr(osutils, '_cached_user_encoding', 'latin-1')
979
982
 
 
983
Temporarily changing environment variables
 
984
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
985
 
 
986
If yout test needs to temporarily change some environment variable value
 
987
(which generally means you want it restored at the end), you can use::
 
988
 
 
989
    self.overrideEnv('BZR_ENV_VAR', 'new_value')
 
990
 
 
991
If you want to remove a variable from the environment, you should use the
 
992
special ``None`` value::
 
993
 
 
994
    self.overrideEnv('PATH', None)
 
995
 
 
996
If you add a new feature which depends on a new environment variable, make
 
997
sure it behaves properly when this variable is not defined (if applicable) and
 
998
if you need to enforce a specific default value, check the
 
999
``TestCase._cleanEnvironment`` in ``bzrlib.tests.__init__.py`` which defines a
 
1000
proper set of values for all tests.
 
1001
 
980
1002
Cleaning up
981
1003
~~~~~~~~~~~
982
1004