/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

(vila) Provides a better isolation from os.environ for tests. (Vincent
 Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
977
977
 
978
978
    self.overrideAttr(osutils, '_cached_user_encoding', 'latin-1')
979
979
 
 
980
Temporarily changing environment variables
 
981
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
982
 
 
983
If yout test needs to temporarily change some environment variable value
 
984
(which generally means you want it restored at the end), you can use::
 
985
 
 
986
    self.overrideEnv('BZR_ENV_VAR', 'new_value')
 
987
 
 
988
If you want to remove a variable from the environment, you should use the
 
989
special ``None`` value::
 
990
 
 
991
    self.overrideEnv('PATH', None)
 
992
 
 
993
If you add a new feature which depends on a new environment variable, make
 
994
sure it behaves properly when this variable is not defined (if applicable) and
 
995
if you need to enforce a specific default value, check the
 
996
``TestCase._cleanEnvironment`` in ``bzrlib.tests.__init__.py`` which defines a
 
997
proper set of values for all tests.
 
998
 
980
999
Cleaning up
981
1000
~~~~~~~~~~~
982
1001