Merge pull request #8430 from evildmp/evolutionary-documentation-restructure

Renamed Install to Getting started; moved notes to index.
This commit is contained in:
Ran Benita 2021-03-11 09:17:03 +02:00 committed by GitHub
commit ce2ad8ebd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 37 additions and 36 deletions

View File

@ -2,7 +2,7 @@
<ul> <ul>
<li><a href="{{ pathto('index') }}">Home</a></li> <li><a href="{{ pathto('index') }}">Home</a></li>
<li><a href="{{ pathto('getting-started') }}">Install</a></li> <li><a href="{{ pathto('getting-started') }}">Get started</a></li>
<li><a href="{{ pathto('contents') }}">Contents</a></li> <li><a href="{{ pathto('contents') }}">Contents</a></li>
<li><a href="{{ pathto('reference') }}">API Reference</a></li> <li><a href="{{ pathto('reference') }}">API Reference</a></li>
<li><a href="{{ pathto('example/index') }}">Examples</a></li> <li><a href="{{ pathto('example/index') }}">Examples</a></li>

View File

@ -1,5 +1,5 @@
The writing and reporting of assertions in tests How to write and report assertions in tests
================================================== ==================================================
.. _`assertfeedback`: .. _`assertfeedback`:

View File

@ -1,8 +1,8 @@
.. _bash_completion: .. _bash_completion:
Setting up bash completion How to set up bash completion
========================== =============================
When using bash as your shell, ``pytest`` can use argcomplete When using bash as your shell, ``pytest`` can use argcomplete
(https://argcomplete.readthedocs.io/) for auto-completion. (https://argcomplete.readthedocs.io/) for auto-completion.

View File

@ -1,7 +1,7 @@
.. _`captures`: .. _`captures`:
Capturing of the stdout/stderr output How to capture stdout/stderr output
========================================================= =========================================================
Default stdout/stderr/stdin capturing behaviour Default stdout/stderr/stdin capturing behaviour

View File

@ -1,7 +1,7 @@
.. _existingtestsuite: .. _existingtestsuite:
Using pytest with an existing test suite How to use pytest with an existing test suite
=========================================== ==============================================
Pytest can be used with most existing test suites, but its Pytest can be used with most existing test suites, but its
behavior differs from other test runners such as :ref:`nose <noseintegration>` or behavior differs from other test runners such as :ref:`nose <noseintegration>` or

View File

@ -1,22 +1,14 @@
Installation and Getting Started Get Started
=================================== ===================================
**Pythons**: Python 3.6, 3.7, 3.8, 3.9, PyPy3
**Platforms**: Linux and Windows
**PyPI package name**: `pytest <https://pypi.org/project/pytest/>`_
**Documentation as PDF**: `download latest <https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf>`_
``pytest`` is a framework that makes building simple and scalable tests easy. Tests are expressive and readable—no boilerplate code required. Get started in minutes with a small unit test or complex functional test for your application or library.
.. _`getstarted`: .. _`getstarted`:
.. _`installation`: .. _`installation`:
Install ``pytest`` Install ``pytest``
---------------------------------------- ----------------------------------------
``pytest`` requires: Python 3.6, 3.7, 3.8, 3.9, or PyPy3.
1. Run the following command in your command line: 1. Run the following command in your command line:
.. code-block:: bash .. code-block:: bash
@ -35,7 +27,7 @@ Install ``pytest``
Create your first test Create your first test
---------------------------------------------------------- ----------------------------------------------------------
Create a simple test function with just four lines of code: Create a new file called ``test_sample.py``, containing a function, and a test:
.. code-block:: python .. code-block:: python
@ -47,7 +39,7 @@ Create a simple test function with just four lines of code:
def test_answer(): def test_answer():
assert func(3) == 5 assert func(3) == 5
Thats it. You can now execute the test function: The test
.. code-block:: pytest .. code-block:: pytest

View File

@ -13,10 +13,19 @@ pytest: helps you write better programs
.. module:: pytest .. module:: pytest
The ``pytest`` framework makes it easy to write small tests, yet The ``pytest`` framework makes it easy to write small, readable tests, and can
scales to support complex functional testing for applications and libraries. scale to support complex functional testing for applications and libraries.
An example of a simple test:
**Pythons**: ``pytest`` requires: Python 3.6, 3.7, 3.8, 3.9, or PyPy3.
**PyPI package name**: `pytest <https://pypi.org/project/pytest/>`_
**Documentation as PDF**: `download latest <https://media.readthedocs.org/pdf/pytest/latest/pytest.pdf>`_
A quick example
---------------
.. code-block:: python .. code-block:: python
@ -56,7 +65,7 @@ To execute it:
============================ 1 failed in 0.12s ============================= ============================ 1 failed in 0.12s =============================
Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used. Due to ``pytest``'s detailed assertion introspection, only plain ``assert`` statements are used.
See :ref:`Getting Started <getstarted>` for more examples. See :ref:`Get started <getstarted>` for a basic introduction to using pytest.
Features Features

View File

@ -1,7 +1,7 @@
.. _mark: .. _mark:
Marking test functions with attributes How to mark test functions with attributes
====================================== ===========================================
By using the ``pytest.mark`` helper you can easily set By using the ``pytest.mark`` helper you can easily set
metadata on your test functions. You can find the full list of builtin markers metadata on your test functions. You can find the full list of builtin markers

View File

@ -1,5 +1,5 @@
Monkeypatching/mocking modules and environments How to monkeypatch/mock modules and environments
================================================================ ================================================================
.. currentmodule:: _pytest.monkeypatch .. currentmodule:: _pytest.monkeypatch

View File

@ -1,6 +1,6 @@
.. _`noseintegration`: .. _`noseintegration`:
Running tests written for nose How to run tests written for nose
======================================= =======================================
``pytest`` has basic support for running tests written for nose_. ``pytest`` has basic support for running tests written for nose_.

View File

@ -6,7 +6,7 @@
.. _`parametrize-basics`: .. _`parametrize-basics`:
Parametrizing fixtures and test functions How to parametrize fixtures and test functions
========================================================================== ==========================================================================
pytest enables test parametrization at several levels: pytest enables test parametrization at several levels:

View File

@ -2,8 +2,8 @@
.. _`extplugins`: .. _`extplugins`:
.. _`using plugins`: .. _`using plugins`:
Installing and Using plugins How to install and use plugins
============================ ===============================
This section talks about installing and using third party plugins. This section talks about installing and using third party plugins.
For writing your own plugins, please refer to :ref:`writing-plugins`. For writing your own plugins, please refer to :ref:`writing-plugins`.

View File

@ -2,8 +2,8 @@
.. _skipping: .. _skipping:
Skip and xfail: dealing with tests that cannot succeed How to use skip and xfail to deal with tests that cannot succeed
====================================================== =================================================================
You can mark test functions that cannot be run on certain platforms You can mark test functions that cannot be run on certain platforms
or that you expect to fail so pytest can deal with them accordingly and or that you expect to fail so pytest can deal with them accordingly and

View File

@ -2,8 +2,8 @@
.. _`tmpdir handling`: .. _`tmpdir handling`:
.. _tmpdir: .. _tmpdir:
Temporary directories and files How to use temporary directories and files in tests
================================================ ===================================================
The ``tmp_path`` fixture The ``tmp_path`` fixture
------------------------ ------------------------

View File

@ -1,7 +1,7 @@
.. _usage: .. _usage:
Usage and Invocations How to invoke pytest
========================================== ==========================================