Browse by Topic

Popular

Latest

Latest Posts

A pytest command line filtering tests with -k and -m options, showing a focused set of test files.
Python

Python Pytest: Run Specific Tests and Filters

Learn how to run specific pytest tests with node IDs, -k filters, markers, and combined selection to keep test runs focused.

pytesttest selectionpython testingcommand-line
Illustration of pytest running async test functions on an asyncio event loop with await points.
Python

Python pytest asyncio: Writing Async Tests

Learn to write and run async tests with pytest and asyncio: install pytest-asyncio, use async fixtures and markers, control event loop scope, and avoid common failure modes.

pytestasynciopytest-asyncioasync testing
Diagram comparing xunit setup and teardown methods with pytest fixture lifecycle, showing setup, test, and teardown phases.
Python

Python pytest setup/teardown vs fixtures: Which should you use?

Python pytest setup/teardown vs fixtures: Compare xunit-style setup/teardown methods with pytest fixtures to decide which approach improves test isolation, sharing, and maintainability.

pytestfixturessetup teardownpython testing
Illustration of pytest fixture tools isolating a test from environment, filesystem, logs, and output streams
Python

pytest Fixtures: monkeypatch, tmp_path, caplog, and capsys

Learn how pytest's built-in monkeypatch, tmp_path, caplog, and capsys fixtures isolate tests, with examples for environment variables, files, logs, and stdout/stderr.

pytestmonkeypatchtmp_pathcaplog
Illustration of a pytest.raises context block catching a raised exception during Python unit testing.
Python

Python Pytest Exception Testing with pytest.raises

Use pytest.raises to assert exception types and messages in Python: inspect raised exceptions, parametrize test cases, and avoid common mistakes.

pytestexception testingunit testingerror handling
A visual representation of pytest markers controlling test execution with skip, skipif, and xfail conditions.
Python

Python pytest marks: skip, skipif, and xfail

Use pytest's skip, skipif, and xfail markers to control test execution: skip a test unconditionally, skip when a condition is true, or mark a failing test as expected.

pytesttest skippingxfailconditional tests
A Python test function decorated with pytest.mark.parametrize, showing multiple input sets feeding into a single test.
Python

Using pytest.mark.parametrize for Parameterized Tests in Python

Learn how to use pytest.mark.parametrize to write parameterized tests in Python. Covers syntax, multiple arguments, fixtures, custom IDs, class/module-level use, and common pitfalls.

pytestparameterized testingpython testingtest parametrization
Diagram showing pytest fixture scopes from function to session and conftest sharing fixtures across test files.
Python

Python Pytest Fixtures Scope and conftest

Learn how pytest fixture scope controls setup frequency and how conftest.py shares fixtures across test files, including when widening scope is safe.

pytestfixturesconftesttest-scopes
A pytest test file with assert statements being collected and run by the pytest runner.
Python

Python Pytest: Basic Tests, Assertions, and Test Discovery

Learn how to write basic pytest tests with plain assert statements, understand pytest test discovery rules, test exceptions and floating-point values, and run a subset of tests.

pytestpython testingassertionstest discovery
Comparison of Celery and APScheduler for Python task scheduling, showing distributed queue vs in-process scheduler.
Python

Python Celery vs APScheduler: Choosing the Right Task Scheduler

Compare Celery and APScheduler for Python background tasks: architecture, scheduling, reliability, scaling, and when to choose each.

CeleryAPSchedulerTask QueueBackground Tasks