flat is better than nested (cont'd):

- pytest.py is new module, making "python -m pytest" work always
- _pytest/*.py now contains core.py, hookspec and the plugins, no sub packages
This commit is contained in:
holger krekel
2010-11-13 11:10:45 +01:00
parent 2e4e9eb745
commit 929291775e
62 changed files with 181 additions and 168 deletions
+8 -5
View File
@@ -26,14 +26,16 @@ New Features
- new invocations through Python interpreter and from Python::
python -m pytest # on all pythons >= 2.7
python -m pytest.main # on all pythons >= 2.5
python -m pytest # on all pythons >= 2.5
or from a python program::
import pytest ; pytest.main(args, plugins)
see http://pytest.org/2.0.0/usage.html for details.
- new and better reporting information in assert expressions
which compare lists, sequences or strings.
if comparing lists, sequences or strings.
see http://pytest.org/2.0.0/assert.html for details.
@@ -42,7 +44,7 @@ New Features
[pytest]
norecursedirs = .hg data* # don't ever recurse in such dirs
addopts = -x --pyargs # add these options by default
addopts = -x --pyargs # add these command line options by default
see http://pytest.org/2.0.0/customize.html
@@ -51,9 +53,10 @@ New Features
py.test --pyargs unittest
- add a new "-q" option which decreases verbosity and prints a more
- new "-q" option which decreases verbosity and prints a more
nose/unittest-style "dot" output.
Fixes
-----------------------
+1 -1
View File
@@ -1,6 +1,6 @@
# content of conftest.py
import py
import pytest
def pytest_collect_file(path, parent):
if path.ext == ".yml" and path.basename.startswith("test"):
+2 -2
View File
@@ -2,7 +2,7 @@
creating and managing test function arguments
==============================================================
.. currentmodule:: pytest.plugin.python
.. currentmodule:: _pytest.python
.. _`funcargs`:
@@ -92,7 +92,7 @@ Each funcarg factory receives a **request** object which is tied to a
specific test function call. A request object is passed to a funcarg
factory and provides access to test configuration and context:
.. autoclass:: pytest.plugin.python.FuncargRequest()
.. autoclass:: _pytest.python.FuncargRequest()
:members: function,cls,module,keywords,config
.. _`useful caching and finalization helpers`:
+2 -2
View File
@@ -5,8 +5,8 @@ py.test: no-boilerplate testing with Python
.. note::
version 2.0 introduces ``pytest`` as the main Python import name
but for historic reasons ``py.test`` remains fully valid and
represents the same package.
but for compatibility reasons you may continue to use ``py.test``
in your test code.
Welcome to ``py.test`` documentation:
+1 -1
View File
@@ -4,7 +4,7 @@
mark test functions with attributes
=================================================================
.. currentmodule:: pytest.plugin.mark
.. currentmodule:: _pytest.mark
By using the ``py.test.mark`` helper you can instantiate
decorators that will set named meta data on test functions.
+1 -1
View File
@@ -2,7 +2,7 @@
monkeypatching/mocking modules and environments
================================================================
.. currentmodule:: pytest.plugin.monkeypatch
.. currentmodule:: _pytest.monkeypatch
Sometimes tests need to invoke functionality which depends
on global settings or which invokes code which cannot be easily
+1 -1
View File
@@ -4,7 +4,7 @@ Running test written for nose
.. include:: links.inc
py.test has basic support for running tests written for nose_.
This is implemented in :pymod:`pytest.plugin.nose`.
This is implemented in :pymod:`_pytest.nose`.
Usage
-------------
+36 -36
View File
@@ -180,28 +180,28 @@ py.test default plugin reference
.. autosummary::
pytest.plugin.assertion
pytest.plugin.capture
pytest.plugin.config
pytest.plugin.doctest
pytest.plugin.genscript
pytest.plugin.helpconfig
pytest.plugin.junitxml
pytest.plugin.mark
pytest.plugin.monkeypatch
pytest.plugin.nose
pytest.plugin.pastebin
pytest.plugin.pdb
pytest.plugin.pytester
pytest.plugin.python
pytest.plugin.recwarn
pytest.plugin.resultlog
pytest.plugin.runner
pytest.plugin.session
pytest.plugin.skipping
pytest.plugin.terminal
pytest.plugin.tmpdir
pytest.plugin.unittest
_pytest.assertion
_pytest.capture
_pytest.config
_pytest.doctest
_pytest.genscript
_pytest.helpconfig
_pytest.junitxml
_pytest.mark
_pytest.monkeypatch
_pytest.nose
_pytest.pastebin
_pytest.pdb
_pytest.pytester
_pytest.python
_pytest.recwarn
_pytest.resultlog
_pytest.runner
_pytest.session
_pytest.skipping
_pytest.terminal
_pytest.tmpdir
_pytest.unittest
.. _`well specified hooks`:
@@ -222,7 +222,7 @@ hook name itself you get useful errors.
initialisation, command line and configuration hooks
--------------------------------------------------------------------
.. currentmodule:: pytest.hookspec
.. currentmodule:: _pytest.hookspec
.. autofunction:: pytest_cmdline_parse
.. autofunction:: pytest_namespace
@@ -243,11 +243,11 @@ All all runtest related hooks receive a :py:class:`pytest.Item` object.
.. autofunction:: pytest_runtest_makereport
For deeper understanding you may look at the default implementation of
these hooks in :py:mod:`pytest.plugin.runner` and maybe also
in :py:mod:`pytest.plugin.pdb` which intercepts creation
these hooks in :py:mod:`_pytest.runner` and maybe also
in :py:mod:`_pytest.pdb` which intercepts creation
of reports in order to drop to interactive debugging.
The :py:mod:`pytest.plugin.terminal` reported specifically uses
The :py:mod:`_pytest.terminal` reported specifically uses
the reporting hook to print information about a test run.
collection hooks
@@ -284,35 +284,35 @@ test execution:
Reference of important objects involved in hooks
===========================================================
.. autoclass:: pytest.plugin.config.Config
.. autoclass:: _pytest.config.Config
:members:
.. autoclass:: pytest.plugin.config.Parser
.. autoclass:: _pytest.config.Parser
:members:
.. autoclass:: pytest.plugin.session.Node(name, parent)
.. autoclass:: _pytest.session.Node(name, parent)
:members:
..
.. autoclass:: pytest.plugin.session.File(fspath, parent)
.. autoclass:: _pytest.session.File(fspath, parent)
:members:
.. autoclass:: pytest.plugin.session.Item(name, parent)
.. autoclass:: _pytest.session.Item(name, parent)
:members:
.. autoclass:: pytest.plugin.python.Module(name, parent)
.. autoclass:: _pytest.python.Module(name, parent)
:members:
.. autoclass:: pytest.plugin.python.Class(name, parent)
.. autoclass:: _pytest.python.Class(name, parent)
:members:
.. autoclass:: pytest.plugin.python.Function(name, parent)
.. autoclass:: _pytest.python.Function(name, parent)
:members:
.. autoclass:: pytest.plugin.runner.CallInfo
.. autoclass:: _pytest.runner.CallInfo
:members:
.. autoclass:: pytest.plugin.runner.TestReport
.. autoclass:: _pytest.runner.TestReport
:members:
+13 -17
View File
@@ -7,6 +7,19 @@ Usage and Invocations
.. _cmdline:
calling pytest through ``python -m pytest``
-----------------------------------------------------
.. versionadded: 2.0
If you use Python-2.5 or above you can invoke testing through the
Python interpreter from the command line::
python -m pytest [...]
This is equivalent to invoking the command line script ``py.test [...]``
directly.
Getting help on version, option names, environment vars
-----------------------------------------------------------
@@ -38,23 +51,6 @@ Import 'pkg' and use its filesystem location to find and run tests::
py.test --pyargs pkg # run all tests found below directory of pypkg
calling pytest through ``python -m pytest``
-----------------------------------------------------
.. versionadded: 2.0
You can invoke testing through the Python interpreter from the command line::
python -m pytest.main [...]
Python2.7 and Python3 introduced specifying packages to "-m" so there
you can also type::
python -m pytest [...]
All of these invocations are equivalent to the ``py.test [...]`` command line invocation.
Modifying Python traceback printing
----------------------------------------------