测试人社区

Pytest-Examples and customization tricks

Here is a (growing) list of examples.
Contact <contact>{.interpreted-text role=“ref”} us if you need more
examples or have questions. Also take a look at the
comprehensive documentation <toc>{.interpreted-text role=“ref”} which
contains many example snippets as well. Also, pytest on
stackoverflow.com
often comes
with example answers.

For basic examples, see

  • ../getting-started{.interpreted-text role=“doc”} for basic
    introductory examples
  • assert{.interpreted-text role=“ref”} for basic assertion examples
  • Fixtures <fixtures>{.interpreted-text role=“ref”} for basic
    fixture/setup examples
  • parametrize{.interpreted-text role=“ref”} for basic test function
    parametrization
  • ../unittest{.interpreted-text role=“doc”} for basic unittest
    integration
  • ../nose{.interpreted-text role=“doc”} for basic nosetests
    integration

The following examples aim at various use cases you might encounter.

::: {.toctree maxdepth=“2”}
reportingdemo simple parametrize markers special pythoncollection
nonpython
:::