/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

  • Committer: Vincent Ladeuil
  • Date: 2011-08-16 13:12:40 UTC
  • mfrom: (6071 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6076.
  • Revision ID: v.ladeuil+lp@free.fr-20110816131240-gcyn9cik86dxwgz3
Merge into trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
339
339
 
340
340
  __ http://docs.python.org/lib/module-doctest.html
341
341
 
 
342
There is an `assertDoctestExampleMatches` method in
 
343
`bzrlib.tests.TestCase` that allows you to match against doctest-style
 
344
string templates (including ``...`` to skip sections) from regular Python
 
345
tests.
 
346
 
342
347
 
343
348
Shell-like tests
344
349
----------------
511
516
regress.
512
517
 
513
518
This is done by running the command in a subprocess with
514
 
``--profile-imports``.  Starting a whole Python interpreter is pretty
515
 
slow, so we don't want exhaustive testing here, but just enough to guard
516
 
against distinct fixed problems.
 
519
``PYTHON_VERBOSE=1``.  Starting a whole Python interpreter is pretty slow,
 
520
so we don't want exhaustive testing here, but just enough to guard against
 
521
distinct fixed problems.
517
522
 
518
523
Assertions about precisely what is loaded tend to be brittle so we instead
519
524
make assertions that particular things aren't loaded.
1013
1018
 
1014
1019
    self.overrideAttr(osutils, '_cached_user_encoding', 'latin-1')
1015
1020
 
 
1021
This should be used with discretion; sometimes it's better to make the
 
1022
underlying code more testable so that you don't need to rely on monkey
 
1023
patching.
 
1024
 
 
1025
 
 
1026
Observing calls to a function
 
1027
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
1028
 
 
1029
Sometimes it's useful to observe how a function is called, typically when
 
1030
calling it has side effects but the side effects are not easy to observe
 
1031
from a test case.  For instance the function may be expensive and we want
 
1032
to assert it is not called too many times, or it has effects on the
 
1033
machine that are safe to run during a test but not easy to measure.  In
 
1034
these cases, you can use `recordCalls` which will monkey-patch in a
 
1035
wrapper that records when the function is called.
 
1036
 
 
1037
 
1016
1038
Temporarily changing environment variables
1017
1039
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1018
1040
 
1067
1089
 
1068
1090
    tc qdisc add dev lo root handle 1: prio
1069
1091
    tc qdisc add dev lo parent 1:3 handle 30: netem delay 500ms 
1070
 
    tc qdisc add dev lo parent 30:1 handle 40: prio
1071
 
    tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip dport 4155 0xffff flowid 1:3 handle 800::800
1072
 
    tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip sport 4155 0xffff flowid 1:3 handle 800::801
 
1092
    tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip dport 4155 0xffff flowid 1:3 
 
1093
    tc filter add dev lo protocol ip parent 1:0 prio 3 u32 match ip sport 4155 0xffff flowid 1:3 
1073
1094
 
1074
1095
and to remove this::
1075
1096