Skip to main content

Automate and customize test scheduling effortlessly on local machines.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest_schedule-0.0.8.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytest_schedule-0.0.8-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file pytest_schedule-0.0.8.tar.gz.

File metadata

  • Download URL: pytest_schedule-0.0.8.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for pytest_schedule-0.0.8.tar.gz
Algorithm Hash digest
SHA256 702d2b1a2e70420a89314cbcee3d5ff5c5fc0cbdb9847631783eb165a4da8414
MD5 a6ccea7d76bffb097ad226599ab26b48
BLAKE2b-256 15a931b590bd022fe87055fd0a0ad7c3b8c508bb28a6f4475fea05148b950553

See more details on using hashes here.

File details

Details for the file pytest_schedule-0.0.8-py3-none-any.whl.

File metadata

File hashes

Hashes for pytest_schedule-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6d8514a98f23fceb0008d18c372538d3ce0216d50090a34bdff8c3ff397bbf0d
MD5 80dbf497be139724b66ddd5cf8dd96b2
BLAKE2b-256 b87b0d16eb5f6cea176ea6e0afa4be6815e7a7c4f91668651942535223c7497e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page