Skip to main content

pytest-schedule

Automate and customize test scheduling effortlessly on local machines.

Installation

To install pytest-schedule, use the following command:

pip install pytest-schedule

Make sure you have pytest installed as well:

pip install pytest

Usage

Generate a Test Tree

To recursively generate a JSON tree of test module names from the root directory, use:

python -m pytest_schedule.generate schedule_json

This will create a file named schedule.json in the root directory.


Run Tests with Custom Tags

Execute tests with specific tags as defined in pytest_schedule.json.

Examples:

python -m pytest_schedule -t <tag>
python -m pytest_schedule --tags smoke,unittest,integration
python -m pytest_schedule --tag unittest --test_module unittest
python -m pytest_schedule --tag unittest --test_module pytest

Schedule Test Execution Times

To set specific test execution times, modify pytest_schedule.json following this structure:

{
  "0.0.7": [
    {
      "smoke": [
        {
          "test_binary_tree_0.py": "10:15:00"
        }
      ]
    },
    {
      "smoke": [
        {
          "test_module_binary_tree_1_0.py": "10:10:00"
        }
      ]
    },
    {
      "tag": [
        {
          "test_module_binary_tree_2_0_0.py": "00:00:00"
        }
      ]
    }
  ]
}

Command Options

To see all available options, run:

python -m pytest_schedule --help

Logging

Stdout logs are generated in the following format:

[10:49:35] | PYTEST-SCHEDULE |  The job process started.
[10:49:35] | PYTEST-SCHEDULE |   (1) tag::test_a.py::11:50:00 task waiting ..
[10:50:00] | PYTEST-SCHEDULE |   (1) tag::test_a.py::11:50:00 task started ..
[10:50:00] | PYTEST-SCHEDULE |   (1) tag::test_a.py::11:50:00 task completed   [FAILED]
[10:50:00] | PYTEST-SCHEDULE |  The job process finished.

The log file is generated in the root directory with the name pytest_schedule.log.

Release files for pytest-schedule 0.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-schedule 0.0.8
File Size Uploaded
pytest_schedule-0.0.8.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-schedule 0.0.8
File Interpreter ABI Platform
pytest_schedule-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 9.4 kB

Release files / pytest_schedule-0.0.8.tar.gz

Download URL pytest_schedule-0.0.8.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
702d2b1a2e70420a89314cbcee3d5ff5c5fc0cbdb9847631783eb165a4da8414
BLAKE2b-256 checksum
How to use checksums
15a931b590bd022fe87055fd0a0ad7c3b8c508bb28a6f4475fea05148b950553
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / pytest_schedule-0.0.8-py3-none-any.whl

Download URL pytest_schedule-0.0.8-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6d8514a98f23fceb0008d18c372538d3ce0216d50090a34bdff8c3ff397bbf0d
BLAKE2b-256 checksum
How to use checksums
b87b0d16eb5f6cea176ea6e0afa4be6815e7a7c4f91668651942535223c7497e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.0.8 This release

2 release files

0.0.7

2 release files

0.0.6

1 release file

0.0.5

1 release file

0.0.4

1 release file

0.0.3

1 release file

0.0.2

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page