{"id":21851603,"url":"https://github.com/antonio-leitao/jet","last_synced_at":"2026-02-02T08:01:16.912Z","repository":{"id":64618646,"uuid":"566474243","full_name":"antonio-leitao/jet","owner":"antonio-leitao","description":"JET is a testing library for python aimed at being fast to set up, easy to use and above all pleasing to the eye. Because testing does not have to be a chore to set up, clutter the terminal or ugly to look at.","archived":false,"fork":false,"pushed_at":"2024-03-11T13:06:04.000Z","size":5203,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-24T18:56:10.475Z","etag":null,"topics":["python","testing","testing-library","testing-tools"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/antonio-leitao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-15T18:47:56.000Z","updated_at":"2023-01-31T20:58:18.000Z","dependencies_parsed_at":"2024-11-28T01:09:00.884Z","dependency_job_id":"9ddc0db8-e151-4f47-9b39-7019fea2a86d","html_url":"https://github.com/antonio-leitao/jet","commit_stats":{"total_commits":134,"total_committers":1,"mean_commits":134.0,"dds":0.0,"last_synced_commit":"30d083b80829c28d6ad54faa766c7a72da3a27ff"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/antonio-leitao/jet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonio-leitao%2Fjet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonio-leitao%2Fjet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonio-leitao%2Fjet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonio-leitao%2Fjet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/antonio-leitao","download_url":"https://codeload.github.com/antonio-leitao/jet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/antonio-leitao%2Fjet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261739498,"owners_count":23202614,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","testing","testing-library","testing-tools"],"created_at":"2024-11-28T01:08:56.469Z","updated_at":"2026-02-02T08:01:16.802Z","avatar_url":"https://github.com/antonio-leitao.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src='assets/logo.svg' width='200px' align=\"center\"\u003e\u003c/img\u003e\n\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003ch3 max-width='200px' align=\"center\"\u003eJet\u003c/h3\u003e\n  \u003cp\u003e\u003ci\u003eMinimal testing library for Python\u003cbr/\u003e\n  Aesthetics oriented\u003cbr/\u003e\n  No steup required\u003c/i\u003e\u003cbr/\u003e\u003c/p\u003e\n  \u003cp\u003e\n\u003cimg alt=\"Pepy Total Downlods\" src=\"https://img.shields.io/pepy/dt/jet-test?style=for-the-badge\u0026logo=python\u0026labelColor=white\u0026color=blue\"\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n#\n\nJET is a testing library for python aimed at being fast to set up, easy to use and above all pleasing to the eye. Because testing does not have to be a chore to set up, clutter the terminal or ugly to look at.\n\n##### Contents\n  - [Installation](#installation)\n  - [Running Tests](#running-tests)\n  - [Reading Reports](#reading-reports)\n  - [Mastering Verbosity](#mastering-verbosity)\n  - [Custom Fail Conditions](#custom-fail-conditions)\n  - [Further Customizations](#further-customizations)\n\n\n\u003cp align=\"center\"\u003e\n  \u003cimg alt=\"JET demo\" src=\"assets/one_liner.gif\" width=\"600\" /\u003e\n\u003c/p\u003e\n\n# Installation\n\n\u003e **Note**\n\u003e JET requires [`gum`](https://github.com/charmbracelet/gum) to be installed and available on your `PATH`.\n\nBest way to install jet is through pip:\n\n```sh\npip install jet-test\n```\n\n# Running Tests\n\n```sh\njet run \u003coption\u003e\n```\n\n- `--all`: Run all test modules. Skips initial module selection.\n- `--dir`: Path to tests directory. Defaults to /tests when not supplied.\n- `--files`: List of modules to consider instead of entire directory.\n- `--quiet`: Disable test ouput verbose as they run.\n- `--n-jobs`: Number of processes to use in parallel when running tests. Defaults to one.\n- `--percentage`: Whether to show progress as a percentage instead of count.\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"JET demo\" src=\"assets/run.gif\" width=\"600\" /\u003e\n\u003c/p\u003e\n\nJET searches for the tests folder in your working directory. You can supply a different directory with the `--dir` flag. Inside it searches for all modules in the form `test_\u003csomething\u003e.py` and uses their `__doc__` as description. JET prompts you to choose the modules to run, you can skip this by raising the `--all` flag. You can also specify individual modules by passing them to `--files`. The path of each module is always relative to the specified `--dir`.\n\n```text\ndirectory\n│   README.md\n└───tests\n│   │   test_array_operations.py\n│   │   test_verbose_levels.py\n|   |   test_custom_fail_conditions.py\n│   \n...\n```\nInside each module JET runs all functions that start with `test_\u003csomething\u003e`. Below is an example test module.\n```python\n\"\"\"\"This is the __doc__ of the test module.\nIt will be shown as description in the module choice\n\"\"\"\"\n\n# this function will NOT be considered as a test \ndef set_variables():\n    a = 2\n    b = 1\n    return a,b\n\n# this function will be considered as a test function. \ndef test_sum():\n    \"\"\"This will be shown if the test succeds\"\"\"\n    a,b = set_variables()\n    assert a==b, \"this will be shown if the test fails\"\n```\nFor example the following command will:\n```sh\njet run --all --dir different_test_folder --files test_user_auth.py test_admin_auth.py --quiet --n-jobs 4 --percentage\n```\n- Skip module selection and run all modules.\n- Run the tests in the modules: `different_test_folder/test_user_auth.py` and `different_test_folder/test_user_auth.py`.\n- Do not display results as it runs, only end summary.\n- Run tests using 4 threads.\n- Show progress as a percentage (x%) instead of a count (x/n).\n\n\n# Reading Reports\n\n```sh\njet see \u003coption\u003e\n```\nSpecific options for the `see` command:\n\n- `--dir`: Path to tests directory. Defaults to /tests when not supplied.\n- `--doc-width`: Width (number of columns collumns) of report doc.\n- `--text-width`: Width (number of columns collumns) of text blocks in report.\n- `--buffer`: Number of lines of code to show in the report.\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"JET demo\" src=\"assets/see.gif\" width=\"600\" /\u003e\n\u003c/p\u003e\n\nAll tests that did not pass can be further inspected. The `see` command prompts the user to choose one of the failed tests and provides a collapsable report that displays:\n- Error name: Failed / ErrorType / WarningType / {Customizable}\n- Expected behaviour: User defined test `__doc__`\n- Captured output: all output printed during the test runtime (`print()`)\n- Test name @ test module: along with test source code highlighting error line.\n- Local variables: value of test local variables at the time of failure. \n\nYou can press `q` to close the collapsable report as to not clutter your terminal.\n\n# Mastering Verbosity\n\nJET displays the result of each test after it has been run, unless the `--quiet` flag is raised.\n\n- **PASS**: Displays the tests's `__doc__`. If no `__doc__` is available, it shows the test's `__name__`.\n- **FAIL**: Displays the error description. This behaviour is specially usefull of a test has more than one failing condition, for example:\n\n```python\n#tests have to start with test_\ndef test_example():\n   \"\"\"This is the text that will be display if the test passes\"\"\"\n   a = 1\n   b = 2\n   assert a == 1, \"Text displayed if a is not equal to 1\"\n   assert b == 2, \"Text displayed if b is not equal to 2\"\n```\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"JET demo\" src=\"assets/verbosity.gif\" width=\"600\" /\u003e\n\u003c/p\u003e\n\n# Custom Fail Conditions\n\nSuppose you want a test to fail if its' running time exceeds 0.5 seconds. We do that by creating a wrapper that raises a custom error when the condition is failed.\n\n```python\nimport timeit\nimport time\nfrom functools import wraps\n\ndef timebounded(test_function):\n    \"\"\"Example wrapper for a custom suport.\n    Throws an error if the wrapped function exceeds a certain amount of time to run\"\"\"\n\n    @wraps(test_function)\n    def wrappee():\n        elapsed = timeit.timeit(test_function, number=1)\n        if elapsed \u003e 0.5:\n            raise PatienceError(\n                f\"CUSTOM ERROR: The function called {test_function.__name__} exceded my patience\"\n            )\n\n    return wrappee\n\n# Just wrap wahtever tests you want with the timebounded function and you're good to go.\n@timebounded\ndef test_timings_of_calculation():\n    \"\"\"The function should not exeed 0.5 seconds.\"\"\"\n    time.sleep(1)\n```\n\nThe custom error and description and variables will show up both on the run erbose but also in the error report. This example can easily be expanded to add different and more complex failing conditions such as memory allocation and network usage etc.\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"JET demo\" src=\"assets/custom_error.gif\" width=\"600\" /\u003e\n\u003c/p\u003e\n\n# Further Customizations\n\nGlobal JET customization options:\n\n```sh\njet \u003coption\u003e \u003ccommand\u003e\n```\n\n- `--foreground`: color (hex, rgb or terminal256) for foreground elements.\n- `--background`: color (hex, rgb or terminal256) for background.\n- `--pass-color`: color (hex, rgb or terminal256) for pass tests.\n- `--failed-color`: color (hex, rgb or terminal256) for failed tests.\n- `--error-color`: color (hex, rgb or terminal256) for tests that result in errors.\n- `--warning-color`: color (hex, rgb or terminal256) for tests that throw warnings.\n\n\u003cp align=\"center\"\u003e\n\u003cimg alt=\"JET demo\" src=\"assets/colors.gif\" width=\"600\" /\u003e\n\u003c/p\u003e\n\n## Contributors\n![GitHub Contributors Image](https://contrib.rocks/image?repo=antonio-leitao/jet)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonio-leitao%2Fjet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantonio-leitao%2Fjet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantonio-leitao%2Fjet/lists"}