• Home
  • Raw
  • Download

Lines Matching +full:regression +full:- +full:test

2 :mod:`test` --- Regression tests package for Python
5 .. module:: test
6 :synopsis: Regression tests package containing the testing suite for Python.
10 The :mod:`test` package is meant for internal use by Python only. It is
17 The :mod:`test` package contains all regression tests for Python as well as the
18 modules :mod:`test.support` and :mod:`test.regrtest`.
19 :mod:`test.support` is used to enhance your tests while
20 :mod:`test.regrtest` drives the testing suite.
22 Each module in the :mod:`test` package whose name starts with ``test_`` is a
26 ``sys.stdout``; this style of test is considered deprecated.
32 Writing PyUnit regression tests.
38 .. _writing-tests:
40 Writing Unit Tests for the :mod:`test` package
41 ----------------------------------------------
44 guidelines. One is to name the test module by starting it with ``test_`` and end
45 it with the name of the module being tested. The test methods in the test module
47 testing. This is needed so that the methods are recognized by the test driver as
48 test methods. Also, no documentation string for the method should be included. A
50 to provide documentation for test methods. This is done because documentation
51 strings get printed out if they exist and thus what test is being run is not
57 from test import support
70 # Test feature one.
74 # Test feature two.
77 ... more test methods ...
82 ... more test classes ...
93 This boilerplate code allows the testing suite to be run by :mod:`test.regrtest`
96 The goal for regression testing is to try to break code. This leads to a few
112 * Exhaust as many code paths as possible. Test where branching occurs and thus
115 * Add an explicit test for any bugs discovered for the tested code. This will
122 * If a test is dependent on a specific condition of the operating system then
123 verify the condition already exists before attempting the test.
127 behavior from side-effects of importing a module.
131 basic test class with a class that specifies the input::
152 Test Driven Development
158 Running tests using the command-line interface
159 ----------------------------------------------
161 The :mod:`test.regrtest` module can be run as a script to drive Python's regression
162 test suite, thanks to the :option:`-m` option: :program:`python -m test.regrtest`.
163 Running the script by itself automatically starts running all regression
164 tests in the :mod:`test` package. It does this by finding all modules in the
167 be passed to the script. Specifying a single regression test (:program:`python
168 -m test.regrtest test_spam`) will minimize output and only print whether
169 the test passed or failed and thus minimize output.
171 Running :mod:`test.regrtest` directly allows what resources are available for
172 tests to use to be set. You do this by using the ``-u`` command-line
173 option. Specifying ``all`` as the value for the ``-u`` option enables all
174 possible resources: :program:`python -m test.regrtest -uall`.
176 comma-separated list of resources that are not desired may be listed after
177 ``all``. The command :program:`python -m test.regrtest -uall,-audio,-largefile`
178 will run :mod:`test.regrtest` with all resources except the ``audio`` and
179 ``largefile`` resources. For a list of all resources and more command-line
180 options, run :program:`python -m test.regrtest -h`.
182 Some other ways to execute the regression tests depend on what platform the
183 tests are being executed on. On Unix, you can run :program:`make test` at the
184 top-level directory where Python was built. On Windows, executing
185 :program:`rt.bat` from your :file:`PCBuild` directory will run all regression
189 The :mod:`test` package can be run as a script: :program:`python -m test`.
190 This works the same as running the :mod:`test.regrtest` module.
193 :mod:`test.support` --- Utility functions for tests
196 .. module:: test.support
197 :synopsis: Support for Python regression tests.
201 The :mod:`test.test_support` module has been renamed to :mod:`test.support`
202 in Python 3.x and 2.7.14. The name ``test.test_support`` has been retained
205 The :mod:`test.support` module provides support for Python's regression
213 Exception to be raised when a test fails. This is deprecated in favor of
214 :mod:`unittest`\ -based tests and :class:`unittest.TestCase`'s assertion
224 The :mod:`test.support` module defines the following constants:
230 detailed information is desired about a running test. *verbose* is set by
231 :mod:`test.regrtest`.
249 The :mod:`test.support` module defines the following functions:
255 byte-compiled files of the module.
261 available resources is only set when :mod:`test.regrtest` is executing the
270 Used when tests are executed by :mod:`test.regrtest`.
300 easier to test that a warning was correctly raised. It is approximately
305 ``check_warnings`` accepts 2-tuples of the form ``("message regexp",
310 test fails, and if any warnings are raised that do not match any of the
311 specified filters the test fails. To disable the first of these checks,
342 When a test needs to look more deeply into the warnings, rather than
355 Here all warnings will be caught, and the test code tests the captured
368 accepts 2-tuples of the form ``("message regexp", WarningCategory)`` as
432 # affecting the version being used by the rest of the test suite
441 The :mod:`test.support` module defines the following classes: