# pytest-tally
### A Pytest plugin that displays test run progress in-console, in-app or in-browser.
## Using Rich:
![2023-04-14 18 34 48](https://user-images.githubusercontent.com/4308435/232174467-752c5d13-15e3-4c23-9430-1087050af0a4.gif)
## Using Tkinter:
![2023-05-21 23 33 27](https://github.com/jeffwright13/pytest-tally/assets/4308435/7bb98b54-f796-4249-81d0-f2c283a7c6a3)
## Using Flask:
![2023-05-17 15 15 02](https://github.com/jeffwright13/pytest-tally/assets/4308435/a35151e2-64fe-40e2-bd2e-9a59033edcd3)
## Why?
I run a lot of long-duration test campaigns that generate copious amounts of console output. I usually monitor their progress by periodically checking the terminal to see if anything has failed so far. This usually means scrolling back in the console, looking for that telltale FAILED indication. It can be a bit of a pain hunting for that information!
This plugin writes up-to-date summary statistics for each test, as it executes, to a JSON file on disk. That file is then continually read by a small client that prints results to terminal or in-browser. That way I can split my screen and monitor both the raw console output from Pytest, and the client's summary output, at the same time. Mmmm. Life suddenly just became a little easier and brighter. :-)
## Also - why??
Because I'm a geek and I like learning new stuff about Python. This project made me learn about realtime file syncing, different ways of presenting data, how to get ChatGpt to write stuff for you, and a lot more!
## Install
For most users: `pip install pytest-tally`
For users who like to 'roll their own': `pip install -r requirements/requirements.txt && pip install pytest-tally`
For power users who want the dev dependencies: `pip install -r requirements/requirements-dev.txt && pip install pytest-tally`
## Usage
There are three clients included in this repo:
- Rich text-based client that runs in the terminal
- HTML client that runs in the browser (via a Flask web-app)
- TkInter GUI
Each of these has known issues (see below), but are functional. You are welcome to improve upon any of these, or write your own and submit a PR if you like.
To use text-based Rich client to display test results in-console as the tests run, open another terminal session, activate your venv, and type in `tally` to start the text-based client. Press the "q" key to quit the text-based client.
To use web-app Flask/HTML client to display test results in-browser as the tests run, open another terminal session, activate your venv, and type in `python pytest_tally/clients/app.py [-h] [--port PORT] JSON_FILE_PATH` to start the Flask web-app.
Now, simply run Pytest like you normally would, but specify the `--tally` option: `pytest --tally`. This starts the Pytest run and populates the tally-data.json file with the information needed by the client to show the updateded test status as it occurs.
### Pytest Plugin:
The pytest plugin adds the option `--tally`, and when invoked in that fashion, it generates a JSON file to disk that contains the updated test stats that are then used by one of the clients to display progress. The file is called "tally-data.json", and will be written to the current running directory.
pytest tally:
--tally Enable the pytest-tally plugin. Writes live summary results
data to a JSON file for consumption by a dashboard client.
### Rich (text-based) Client:
usage: tally-rich [-h] [-v] [-l] [-x MAX_ROWS] [-f FILE_PATH] [filename]
options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-l, --lines draw separation [l]ines in between each table row (default: False)
-x MAX_ROWS, --max_rows MAX_ROWS
ma[x] number of rows to display (default: 0 [no limit])
_Limitations_
- Non-default JSON file support not working.
### Flask (web-app) Client:
usage: tally-flask [-h] [--port PORT] [--debug] [--log-level LOG_LEVEL] [--fetch-rate FETCH_RATE] [JSON_FILE]
positional arguments:
JSON_FILE path to the JSON file (default: /Users/jwr003/coding/pytest-tally/tally-data.json)
options:
-h, --help show this help message and exit
--port PORT listening port for the app
--debug enable debug mode
--log-level LOG_LEVEL
log level for Werkzeug
--fetch-rate FETCH_RATE
fetch rate (in ms) - effectively the update rate of the web app
_Limitations_
- Non-default JSON file support not working.
### TkInter (GUI) Client:
usage: tally-tk
_Limitations_
- Non-default JSON file support not working.
- No command line options. The intent is to provide all configuration through the app itself, but so far none are implemented.
Raw data
{
"_id": null,
"home_page": "https://github.com/jeffwright13/pytest-tally",
"name": "pytest-tally",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "pytest pytest-plugin testing tui rich blessed",
"author": "Jeff Wright",
"author_email": "jeff.washcloth@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/da/ec/307e2f5e558d8e3e0ae262b7c4b6340c4f61d7e6b6b657e4e452d30a1235/pytest-tally-1.3.1.tar.gz",
"platform": null,
"description": "# pytest-tally\n\n### A Pytest plugin that displays test run progress in-console, in-app or in-browser.\n\n## Using Rich:\n![2023-04-14 18 34 48](https://user-images.githubusercontent.com/4308435/232174467-752c5d13-15e3-4c23-9430-1087050af0a4.gif)\n\n## Using Tkinter:\n![2023-05-21 23 33 27](https://github.com/jeffwright13/pytest-tally/assets/4308435/7bb98b54-f796-4249-81d0-f2c283a7c6a3)\n\n## Using Flask:\n![2023-05-17 15 15 02](https://github.com/jeffwright13/pytest-tally/assets/4308435/a35151e2-64fe-40e2-bd2e-9a59033edcd3)\n\n\n## Why?\nI run a lot of long-duration test campaigns that generate copious amounts of console output. I usually monitor their progress by periodically checking the terminal to see if anything has failed so far. This usually means scrolling back in the console, looking for that telltale FAILED indication. It can be a bit of a pain hunting for that information!\n\nThis plugin writes up-to-date summary statistics for each test, as it executes, to a JSON file on disk. That file is then continually read by a small client that prints results to terminal or in-browser. That way I can split my screen and monitor both the raw console output from Pytest, and the client's summary output, at the same time. Mmmm. Life suddenly just became a little easier and brighter. :-)\n\n## Also - why??\n\nBecause I'm a geek and I like learning new stuff about Python. This project made me learn about realtime file syncing, different ways of presenting data, how to get ChatGpt to write stuff for you, and a lot more!\n\n## Install\nFor most users: `pip install pytest-tally`\nFor users who like to 'roll their own': `pip install -r requirements/requirements.txt && pip install pytest-tally`\nFor power users who want the dev dependencies: `pip install -r requirements/requirements-dev.txt && pip install pytest-tally`\n\n## Usage\n\nThere are three clients included in this repo:\n- Rich text-based client that runs in the terminal\n- HTML client that runs in the browser (via a Flask web-app)\n- TkInter GUI\n\nEach of these has known issues (see below), but are functional. You are welcome to improve upon any of these, or write your own and submit a PR if you like.\n\nTo use text-based Rich client to display test results in-console as the tests run, open another terminal session, activate your venv, and type in `tally` to start the text-based client. Press the \"q\" key to quit the text-based client.\n\nTo use web-app Flask/HTML client to display test results in-browser as the tests run, open another terminal session, activate your venv, and type in `python pytest_tally/clients/app.py [-h] [--port PORT] JSON_FILE_PATH` to start the Flask web-app.\n\nNow, simply run Pytest like you normally would, but specify the `--tally` option: `pytest --tally`. This starts the Pytest run and populates the tally-data.json file with the information needed by the client to show the updateded test status as it occurs.\n\n\n### Pytest Plugin:\nThe pytest plugin adds the option `--tally`, and when invoked in that fashion, it generates a JSON file to disk that contains the updated test stats that are then used by one of the clients to display progress. The file is called \"tally-data.json\", and will be written to the current running directory.\n\n pytest tally:\n --tally Enable the pytest-tally plugin. Writes live summary results\n data to a JSON file for consumption by a dashboard client.\n\n### Rich (text-based) Client:\n\n usage: tally-rich [-h] [-v] [-l] [-x MAX_ROWS] [-f FILE_PATH] [filename]\n\n options:\n -h, --help show this help message and exit\n -v, --version show program's version number and exit\n -l, --lines draw separation [l]ines in between each table row (default: False)\n -x MAX_ROWS, --max_rows MAX_ROWS\n ma[x] number of rows to display (default: 0 [no limit])\n\n_Limitations_\n- Non-default JSON file support not working.\n\n### Flask (web-app) Client:\n\n usage: tally-flask [-h] [--port PORT] [--debug] [--log-level LOG_LEVEL] [--fetch-rate FETCH_RATE] [JSON_FILE]\n\n positional arguments:\n JSON_FILE path to the JSON file (default: /Users/jwr003/coding/pytest-tally/tally-data.json)\n\n options:\n -h, --help show this help message and exit\n --port PORT listening port for the app\n --debug enable debug mode\n --log-level LOG_LEVEL\n log level for Werkzeug\n --fetch-rate FETCH_RATE\n fetch rate (in ms) - effectively the update rate of the web app\n\n_Limitations_\n- Non-default JSON file support not working.\n\n### TkInter (GUI) Client:\n\n usage: tally-tk\n\n\n_Limitations_\n- Non-default JSON file support not working.\n- No command line options. The intent is to provide all configuration through the app itself, but so far none are implemented.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Pytest plugin to generate realtime summary stats, and display them in-console using a text-based dashboard.",
"version": "1.3.1",
"project_urls": {
"Homepage": "https://github.com/jeffwright13/pytest-tally"
},
"split_keywords": [
"pytest",
"pytest-plugin",
"testing",
"tui",
"rich",
"blessed"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "158a53dda086656775d386dbf7414570270ba0e55cc6e0ccf575491b7b2509dc",
"md5": "6151cf4c4e6b80ab0c25fca098613fdd",
"sha256": "24b189971ca646b8221a7e39d6cc7ca869f89f289938d17e91bf5988cd8b750b"
},
"downloads": -1,
"filename": "pytest_tally-1.3.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "6151cf4c4e6b80ab0c25fca098613fdd",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 21617,
"upload_time": "2023-05-22T05:52:42",
"upload_time_iso_8601": "2023-05-22T05:52:42.751191Z",
"url": "https://files.pythonhosted.org/packages/15/8a/53dda086656775d386dbf7414570270ba0e55cc6e0ccf575491b7b2509dc/pytest_tally-1.3.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "daec307e2f5e558d8e3e0ae262b7c4b6340c4f61d7e6b6b657e4e452d30a1235",
"md5": "7f5baa412699a32c2a8b9dabc3ffd885",
"sha256": "2b6838866df753230e81a5c68db4bf322dd75def7531b89691ea261a291d84a6"
},
"downloads": -1,
"filename": "pytest-tally-1.3.1.tar.gz",
"has_sig": false,
"md5_digest": "7f5baa412699a32c2a8b9dabc3ffd885",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 24538,
"upload_time": "2023-05-22T05:52:44",
"upload_time_iso_8601": "2023-05-22T05:52:44.808800Z",
"url": "https://files.pythonhosted.org/packages/da/ec/307e2f5e558d8e3e0ae262b7c4b6340c4f61d7e6b6b657e4e452d30a1235/pytest-tally-1.3.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-22 05:52:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "jeffwright13",
"github_project": "pytest-tally",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pytest-tally"
}