• Home
  • Raw
  • Download

Lines Matching +full:python +full:- +full:tests

2 :mod:`test` --- Regression tests package for Python
6 :synopsis: Regression tests package containing the testing suite for Python.
7 .. sectionauthor:: Brett Cannon <brett@python.org>
10 The :mod:`test` package is meant for internal use by Python only. It is
11 documented for the benefit of the core developers of Python. Any use of
12 this package outside of Python's standard library is discouraged as code
14 Python.
17 The :mod:`test` package contains all regression tests for Python as well as the
19 :mod:`test.support` is used to enhance your tests while
23 testing suite for a specific module or feature. All new tests should be written
24 using the :mod:`unittest` or :mod:`doctest` module. Some older tests are
32 Writing PyUnit regression tests.
35 Tests embedded in documentation strings.
38 .. _writing-tests:
40 Writing Unit Tests for the :mod:`test` package
41 ----------------------------------------------
43 It is preferred that tests that use the :mod:`unittest` module follow a few
49 comment (such as ``# Tests function returns only True or False``) should be used
64 ... code to execute in preparation for tests ...
67 ... code to execute to clean up after tests ...
87 ... list other tests ...
103 * Whitebox testing (examining the code being tested when the tests are being
119 * Make sure to clean up after your tests (such as close and remove all temporary
126 minimizes external dependencies of tests and also minimizes possible anomalous
127 behavior from side-effects of importing a module.
129 * Try to maximize code reuse. On occasion, tests will vary by something as small
153 A book by Kent Beck on writing tests before code.
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`.
164 tests in the :mod:`test` package. It does this by finding all modules in the
166 function :func:`test_main` if present. The names of tests to execute may also
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
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`
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
186 tests.
189 The :mod:`test` package can be run as a script: :program:`python -m test`.
193 :mod:`test.support` --- Utility functions for tests
197 :synopsis: Support for Python regression tests.
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
206 tests.
214 :mod:`unittest`\ -based tests and :class:`unittest.TestCase`'s assertion
255 byte-compiled files of the module.
262 tests.
270 Used when tests are executed by :mod:`test.regrtest`.
284 and executes the tests individually.
294 This will run all tests defined in the named module.
305 ``check_warnings`` accepts 2-tuples of the form ``("message regexp",
355 Here all warnings will be caught, and the test code tests the captured
365 Similar to :func:`check_warnings`, but for Python 3 compatibility warnings.
368 accepts 2-tuples of the form ``("message regexp", WarningCategory)`` as
407 This function imports and returns a fresh copy of the named Python module
434 # the pure Python fallback implementation
478 Class used to record warnings for unit tests. See documentation of