~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to doc/developers/testing.txt

  • Committer: Parth Malwankar
  • Date: 2010-09-24 12:53:00 UTC
  • mfrom: (5443 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5444.
  • Revision ID: parth.malwankar@gmail.com-20100924125300-70sg2t3q03bcuqpm
merged trunk and moved NEWS entry to correct section

Show diffs side-by-side

added added

removed removed

Lines of Context:
446
446
            contents of file
447
447
            ''')
448
448
 
 
449
You can also test commands that read user interaction::
 
450
 
 
451
    def test_confirm_action(self):
 
452
        """You can write tests that demonstrate user confirmation"""
 
453
        commands.builtin_command_registry.register(cmd_test_confirm)
 
454
        self.addCleanup(commands.builtin_command_registry.remove, 'test-confirm')
 
455
        self.run_script("""
 
456
            $ bzr test-confirm
 
457
            2>Really do it? [y/n]: 
 
458
            <yes
 
459
            yes
 
460
            """)
449
461
 
450
462
Import tariff tests
451
463
-------------------
699
711
        _test_needs_features = [features.apport]
700
712
 
701
713
 
 
714
Testing deprecated code
 
715
-----------------------
 
716
 
 
717
When code is deprecated, it is still supported for some length of time,
 
718
usually until the next major version. The ``applyDeprecated`` helper
 
719
wraps calls to deprecated code to verify that it is correctly issuing the
 
720
deprecation warning, and also prevents the warnings from being printed
 
721
during test runs.
 
722
 
 
723
Typically patches that apply the ``@deprecated_function`` decorator should
 
724
update the accompanying tests to use the ``applyDeprecated`` wrapper.
 
725
 
 
726
``applyDeprecated`` is defined in ``bzrlib.tests.TestCase``. See the API
 
727
docs for more details.
 
728
 
 
729
 
702
730
Testing exceptions and errors
703
731
-----------------------------
704
732