#### pytest-schedule
**Automate and customize test scheduling effortlessly on local machines.**
### Installation
To install pytest-schedule, use the following command:
```bash
pip install pytest-schedule
```
Make sure you have pytest installed as well:
```bash
pip install pytest
```
<hr>
### Usage
#### Generate a Test Tree
To recursively generate a JSON tree of test module names from the root directory, use:
```bash
python -m pytest_schedule.generate schedule_json
```
This will create a file named `schedule.json` in the root directory.
<hr>
#### Run Tests with Custom Tags
Execute tests with specific tags as defined in `pytest_schedule.json`.
#### Examples:
```bash
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:
```json
{
"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"
}
]
}
]
}
```
<hr>
#### Command Options
To see all available options, run:
```bash
python -m pytest_schedule --help
```
<hr>
### Logging
Stdout logs are generated in the following format:
```text
[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`.
Raw data
{
"_id": null,
"home_page": null,
"name": "pytest-schedule",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "pytest, schedule, automation, parallel, concurrent, tests, test",
"author": null,
"author_email": "Oleg Matskiv <alpaca00tuha@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/15/a9/31b590bd022fe87055fd0a0ad7c3b8c508bb28a6f4475fea05148b950553/pytest_schedule-0.0.8.tar.gz",
"platform": null,
"description": "#### pytest-schedule\n\n**Automate and customize test scheduling effortlessly on local machines.**\n\n### Installation\n\nTo install pytest-schedule, use the following command:\n\n```bash\npip install pytest-schedule\n```\n\nMake sure you have pytest installed as well:\n\n```bash\npip install pytest\n```\n\n<hr>\n\n### Usage\n\n#### Generate a Test Tree\n\nTo recursively generate a JSON tree of test module names from the root directory, use:\n\n```bash\npython -m pytest_schedule.generate schedule_json\n```\n\nThis will create a file named `schedule.json` in the root directory.\n\n<hr>\n\n#### Run Tests with Custom Tags\n\nExecute tests with specific tags as defined in `pytest_schedule.json`.\n\n#### Examples:\n\n```bash\npython -m pytest_schedule -t <tag>\npython -m pytest_schedule --tags smoke,unittest,integration\npython -m pytest_schedule --tag unittest --test_module unittest\npython -m pytest_schedule --tag unittest --test_module pytest\n```\n\n#### Schedule Test Execution Times\n\nTo set specific test execution times, modify pytest_schedule.json following this structure:\n\n```json\n{\n \"0.0.7\": [\n {\n \"smoke\": [\n {\n \"test_binary_tree_0.py\": \"10:15:00\"\n }\n ]\n },\n {\n \"smoke\": [\n {\n \"test_module_binary_tree_1_0.py\": \"10:10:00\"\n }\n ]\n },\n {\n \"tag\": [\n {\n \"test_module_binary_tree_2_0_0.py\": \"00:00:00\"\n }\n ]\n }\n ]\n}\n```\n\n<hr>\n\n#### Command Options\n\nTo see all available options, run:\n\n```bash\npython -m pytest_schedule --help\n```\n\n<hr>\n\n### Logging\n\nStdout logs are generated in the following format:\n\n```text\n[10:49:35] | PYTEST-SCHEDULE | The job process started.\n[10:49:35] | PYTEST-SCHEDULE | (1) tag::test_a.py::11:50:00 task waiting ..\n[10:50:00] | PYTEST-SCHEDULE | (1) tag::test_a.py::11:50:00 task started ..\n[10:50:00] | PYTEST-SCHEDULE | (1) tag::test_a.py::11:50:00 task completed [FAILED]\n[10:50:00] | PYTEST-SCHEDULE | The job process finished.\n```\n\nThe log file is generated in the root directory with the name `pytest_schedule.log`.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Automate and customize test scheduling effortlessly on local machines.",
"version": "0.0.8",
"project_urls": null,
"split_keywords": [
"pytest",
" schedule",
" automation",
" parallel",
" concurrent",
" tests",
" test"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b87b0d16eb5f6cea176ea6e0afa4be6815e7a7c4f91668651942535223c7497e",
"md5": "80dbf497be139724b66ddd5cf8dd96b2",
"sha256": "6d8514a98f23fceb0008d18c372538d3ce0216d50090a34bdff8c3ff397bbf0d"
},
"downloads": -1,
"filename": "pytest_schedule-0.0.8-py3-none-any.whl",
"has_sig": false,
"md5_digest": "80dbf497be139724b66ddd5cf8dd96b2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 5209,
"upload_time": "2024-10-31T11:43:13",
"upload_time_iso_8601": "2024-10-31T11:43:13.426885Z",
"url": "https://files.pythonhosted.org/packages/b8/7b/0d16eb5f6cea176ea6e0afa4be6815e7a7c4f91668651942535223c7497e/pytest_schedule-0.0.8-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "15a931b590bd022fe87055fd0a0ad7c3b8c508bb28a6f4475fea05148b950553",
"md5": "a6ccea7d76bffb097ad226599ab26b48",
"sha256": "702d2b1a2e70420a89314cbcee3d5ff5c5fc0cbdb9847631783eb165a4da8414"
},
"downloads": -1,
"filename": "pytest_schedule-0.0.8.tar.gz",
"has_sig": false,
"md5_digest": "a6ccea7d76bffb097ad226599ab26b48",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 4226,
"upload_time": "2024-10-31T11:43:14",
"upload_time_iso_8601": "2024-10-31T11:43:14.633508Z",
"url": "https://files.pythonhosted.org/packages/15/a9/31b590bd022fe87055fd0a0ad7c3b8c508bb28a6f4475fea05148b950553/pytest_schedule-0.0.8.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 11:43:14",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pytest-schedule"
}