🌐
pytest
docs.pytest.org › en › stable › reference › reference.html
API Reference - pytest documentation
The exception raised by pytest.fail(). ... Skip an executing test with the given message. This function should be called only during testing (setup, call or teardown) or during collection by using the allow_module_level flag.
🌐
Playwright
playwright.dev › pytest plugin reference
Pytest Plugin Reference | Playwright Python
# install dependency pip install pytest-xdist # use the --numprocesses flag pytest --numprocesses auto
🌐
Readthedocs
pytest-cov.readthedocs.io
pytest-cov 7.1.0 documentation
pytest-cov 7.1.0 documentation · pytest-cov 7.1.0 documentation · Overview · Configuration · Reporting · Debuggers and PyCharm · Distributed testing (xdist) Subprocess support · Contexts · Tox · Plugin coverage · Markers and fixtures · Changelog · Authors ·
🌐
pytest
docs.pytest.org › en › stable › example › markers.html
Working with custom markers - pytest documentation
# content of test_server.py import pytest @pytest.mark.webtest def test_send_http(): pass # perform some webtest test for your app @pytest.mark.device(serial="123") def test_something_quick(): pass @pytest.mark.device(serial="abc") def test_another(): pass class TestClass: def test_method(self): pass
🌐
KodeKloud Notes
notes.kodekloud.com › docs › Python-API-Development-with-FastAPI › Testing › Testing-Flags › page
Testing Flags - KodeKloud
By default, Pytest captures output from print statements. As a result, even though the test function includes a print statement, you won’t see “testing add function” in the default output. To disable this output capture and display print statements during your tests, combine the -s flag with the verbosity flag:
🌐
GitHub
github.com › pytest-dev › pytest › issues › 5689
Add flag which makes pytest to return 0 exit code if no test functions were executed. · Issue #5689 · pytest-dev/pytest
August 3, 2019 - Followup from #812 (comment) and I'm aware about discussion in #500 . a detailed description of the bug or suggestion Title. With this flag added calling pytest --the-flag will return 0 exit code if no test function were found. There are...
Author   WloHu
🌐
pytest
docs.pytest.org › en › stable › contents.html
Full pytest documentation - pytest documentation
Command-line Flags · Anatomy of a test · About fixtures · What fixtures are · Improvements over xUnit-style setup/teardown functions · Fixture errors · Sharing test data · A note about fixture cleanup · Good Integration Practices · Install package with pip · Conventions for Python test discovery · Choosing a test layout · tox · Do not run via setuptools · Checking with flake8-pytest...
Find elsewhere
🌐
Qxf2 BLOG
qxf2.com › home › exploring pytest command line options
Exploring pytest command line options - Qxf2 BLOG
July 10, 2020 - ... This command runs the test based on the keyword expression. e.g. in the below example, we will be running only API tests not bitcoin tests from our suite. ... The -r flag can be used to display a short summary report at the end of the test.
🌐
pytest
docs.pytest.org › en › stable › how-to › output.html
Managing pytest’s output - pytest documentation
pytest --quiet # quiet - less verbose ... -vvv # not a standard , but may be used for even more detail in certain setups · The -v flag controls the verbosity of pytest output in various aspects: test session progress, assertion details when tests fail, fixtures details with --fixtures, ...
🌐
pytest
docs.pytest.org › en › stable › how-to › usage.html
How to invoke pytest - pytest documentation
By default, pytest will not show test durations that are too small (<0.005s) unless -vv is passed on the command-line.
Top answer
1 of 1
1

One option is to use a custom marker and the existing -m command line option. If you redefine your integration decorator like this:

Copyimport pytest

integration = pytest.mark.integration

@integration
def test1():
    pass

def test2():
    pass

And define the integration marker in pytest.ini:

Copy[pytest]
markers =
  integration

Then you can run all tests:

Copy$ pytest -v
========================================= test session starts =========================================
platform linux -- Python 3.11.6, pytest-7.2.2, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/lars/tmp/python, configfile: pytest.ini
collected 2 items

test_skip.py::test1 PASSED                                                                      [ 50%]
test_skip.py::test2 PASSED                                                                      [100%]

========================================== 2 passed in 0.00s ==========================================

Or only integration tests:

Copy$ pytest -v -m integration
========================================= test session starts =========================================
platform linux -- Python 3.11.6, pytest-7.2.2, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/lars/tmp/python, configfile: pytest.ini
collected 2 items / 1 deselected / 1 selected

test_skip.py::test1 PASSED                                                                      [100%]

=================================== 1 passed, 1 deselected in 0.00s ===================================

Or only non-integration tests:

Copy$ pytest -v -m 'not integration'
========================================= test session starts =========================================
platform linux -- Python 3.11.6, pytest-7.2.2, pluggy-1.0.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /home/lars/tmp/python, configfile: pytest.ini
collected 2 items / 1 deselected / 1 selected

test_skip.py::test2 PASSED                                                                      [100%]

=================================== 1 passed, 1 deselected in 0.00s ===================================

This meets your goal of not having to update all your tests.

🌐
TestDriven.io
testdriven.io › blog › pytest-for-beginners
Pytest for Beginners | TestDriven.io
September 28, 2022 - pytest --lf re-runs only the tests that failed during the last run. If there are no failures, all the tests will run. Adding the -x flag causes pytest to exit instantly on the first error or failed test.
🌐
Adam Johnson
adamj.eu › tech › 2019 › 10 › 03 › my-most-used-pytest-commandline-flags
My Most Used pytest Commandline Flags - Adam Johnson
October 3, 2019 - Here are the top five flags I used by frequency. -v, or --verbose, increases the verbosity level. The default level outputs a reasonable amount of information to debug most test failures. However when there are many differences between actual and expected data, some get hidden. In such cases pytest normally appends a message to the failure text such as:
🌐
pytest
docs.pytest.org › en › 6.2.x › usage.html
Usage and Invocations — pytest documentation
By default no output will be shown (because KeyboardInterrupt is caught by pytest). By using this option you make sure a trace is shown. The -r flag can be used to display a “short test summary info” at the end of the test session, making it easy in large test suites to get a clear picture ...
🌐
O'Reilly
oreilly.com › library › view › python-testing-with › 9781680509427 › f_0148.xhtml
Debugging with pytest Flags - Python Testing with pytest [Book]
February 18, 2022 - Flags for selecting which tests to run, in which order, and when to stop:
Author   Brian Okken
Published   2022
Pages   274
🌐
Calmcode
calmcode.io › course › pytest-tricks › pytest-clarity
Calmcode - pytest tricks: Pytest Clarity
By adding this flag, you'll prevent pytest from running any extra tests once it find a breaking test. This can make it much easier to pinpoint the painpoint.
🌐
pytest
docs.pytest.org › en › stable › getting-started.html
Get Started - pytest documentation
$ pytest -q test_sysexit.py . [100%] 1 passed in 0.12s ... The -q/--quiet flag keeps the output brief in this and following examples.
🌐
GitHub
github.com › mananrg › Pytest-Cheatsheet
GitHub - mananrg/Pytest-Cheatsheet: Comprehensive Pytest Cheatsheet · GitHub
-q, --quiet: Decrease verbosity of output. This flag suppresses most informational output and only displays essential information like test outcomes. -s, --capture=no: Disable output capture. By default, pytest captures and hides the stdout/stderr output during test execution.
Starred by 15 users
Forked by 4 users
Languages   HTML 83.7% | CSS 12.0% | Python 4.3%