pytest-brightest


Namepytest-brightest JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryBright ideas for improving your pytest experience
upload_time2025-07-15 22:43:15
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseNone
keywords llm pytest testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pytest-brightest

What is `pytest-brightest`? It is a `pytest` plugin that uses the brightest
ideas in software testing research to illuminate problems with your test suite
and brighten up the execution of your tests.

## Table of Contents

- [Perspectives](#perspectives)
- [Why `pytest-brightest`?](#why-pytest-brightest)
- [Requirements](#requirements)
- [Installation](#installation)
  - [Using `uv`](#using-uv)
  - [Using `poetry`](#using-poetry)
- [Modes of Operation](#modes-of-operation)
  - [Reordering](#reordering)
  - [Shuffling](#shuffling)
- [Command-Line Arguments](#command-line-arguments)
  - [Examples](#examples)
- [Contributing and Reporting Issues](#contributing-and-reporting-issues)

## Perspectives

`pytest-brightest` is a tool that helps software engineers run their test
suites more effectively. Here are three perspectives on how it can be useful:

- **The Busy Developer**: "I need to get feedback from my tests as quickly as
possible. By using `pytest-brightest` to run the fastest tests first, I can find
out if I've introduced any simple bugs in seconds, rather than waiting minutes
for the whole suite to run."
- **The Quality Assurance Engineer**: "My team is struggling with flaky tests
that pass or fail unpredictably. `pytest-brightest`'s shuffling capabilities
help us shine a light on these tests by breaking hidden dependencies, making our
test suite more reliable."
- **The Open-Source Maintainer**: "When a contributor submits a pull request, I
want to be confident it doesn't re-introduce old bugs. Reordering tests to run
previously failing ones first gives me a faster signal, streamlining my review
process."

## Why `pytest-brightest`?

In software testing, not all test executions are created equal. Some tests are
long, others are short. Some are prone to failure, while others are steadfastly
reliable. `pytest-brightest` helps you shine a light on these characteristics
to run your test suite more intelligently. It's not just about leveraging the
brightest ideas from software testing research; it's about making your `test`s
brighter (yes, the pun is intended!). Whether you want to get feedback faster,
find flaky tests, or simply bring more clarity to your testing chaos,
`pytest-brightest` is here to help.

## Requirements

To use `pytest-brightest`, you'll need:

- `pytest`
- `pytest-json-report`

`pytest-brightest` uses the data generated by `pytest-json-report` to work its
magic. If you have `pytest-json-report` installed, `pytest-brightest` will
automatically configure it for you.

## Installation

### Using `uv`

To install `pytest-brightest` using `uv`, a fast Python package installer and
resolver, run the following command:

```bash
uv add pytest-brightest --group dev
```

### Using `poetry`

To install `pytest-brightest` using `poetry`, a tool for dependency management
and packaging in Python, run the following command:

```bash
poetry add pytest-brightest --group dev
```

## Modes of Operation

`pytest-brightest` is enabled with the `--brightest` flag and can operate in
several modes, configured through the `--reorder-by-technique` option.

### Reordering

You can reorder your tests based on a variety of criteria:

- **`cost`**: Reorders tests based on their execution time from the previous
run. This is perfect for getting quick feedback by running faster tests first.
- **`name`**: Reorders tests alphabetically by their name.
- **`failure`**: Reorders tests based on their failure history, running tests
that failed in the previous run first. This is a powerful technique for
regression testing.

### Shuffling

- **`shuffle`**: Randomizes the order of your tests. This is an excellent way to
uncover hidden dependencies between tests and identify "flaky" tests that pass
or fail based on the order in which they are run.

## Command-Line Arguments

Here's a breakdown of the command-line arguments you can use to control
`pytest-brightest`:

- `--brightest`
    - **Description**: Enable the `pytest-brightest` plugin.
    - **Default**: `False`
- `--reorder-by-technique`
    - **Description**: The technique to use for reordering or shuffling tests.
    - **Options**: `shuffle`, `name`, `cost`, `failure`
    - **Default**: `None`
- `--reorder-by-focus`
    - **Description**: The scope of the reordering or shuffling.
    - **Options**: `modules-within-suite`, `tests-within-module`,
    `tests-across-modules`
    - **Default**: `tests-across-modules`
- `--reorder-in-direction`
    - **Description**: The direction of the reordering.
    - **Options**: `ascending`, `descending`
    - **Default**: `ascending`
- `--seed`
    - **Description**: A seed for the random number generator used for
    shuffling, ensuring reproducible results.
    - **Default**: (random)

### Examples

#### Run faster tests first

```bash
pytest --brightest --reorder-by-technique cost --reorder-in-direction ascending
```

#### Run previously failing tests first

```bash
pytest --brightest --reorder-by-technique failure --reorder-in-direction descending
```

#### Shuffle all tests with a specific seed

```bash
pytest --brightest --reorder-by-technique shuffle --seed 12345
```

#### Shuffle tests within each module, but keep the module order

```bash
pytest --brightest --reorder-by-technique shuffle --reorder-by-focus tests-within-module
```

## Contributing and Reporting Issues

Contributions are welcome! This project is open-source and thrives on community
involvement. Let's make testing brighter, together.

- **Issues**: If you find a bug or have a feature request, please [open an
issue](https://github.com/AstuteSource/pytest-brightest/issues).
- **Pull Requests**: If you'd like to contribute code, please [submit a pull
request](https://github.com/AstuteSource/pytest-brightest/pulls).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pytest-brightest",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "llm, pytest, testing",
    "author": null,
    "author_email": "\"Gregory M. Kapfhammer\" <gkapfham@allegheny.edu>",
    "download_url": "https://files.pythonhosted.org/packages/4c/be/bfbe4f1dac2c2b263af2bbc630da56e7f8da213232510cfc74699839b8fa/pytest_brightest-0.1.0.tar.gz",
    "platform": null,
    "description": "# pytest-brightest\n\nWhat is `pytest-brightest`? It is a `pytest` plugin that uses the brightest\nideas in software testing research to illuminate problems with your test suite\nand brighten up the execution of your tests.\n\n## Table of Contents\n\n- [Perspectives](#perspectives)\n- [Why `pytest-brightest`?](#why-pytest-brightest)\n- [Requirements](#requirements)\n- [Installation](#installation)\n  - [Using `uv`](#using-uv)\n  - [Using `poetry`](#using-poetry)\n- [Modes of Operation](#modes-of-operation)\n  - [Reordering](#reordering)\n  - [Shuffling](#shuffling)\n- [Command-Line Arguments](#command-line-arguments)\n  - [Examples](#examples)\n- [Contributing and Reporting Issues](#contributing-and-reporting-issues)\n\n## Perspectives\n\n`pytest-brightest` is a tool that helps software engineers run their test\nsuites more effectively. Here are three perspectives on how it can be useful:\n\n- **The Busy Developer**: \"I need to get feedback from my tests as quickly as\npossible. By using `pytest-brightest` to run the fastest tests first, I can find\nout if I've introduced any simple bugs in seconds, rather than waiting minutes\nfor the whole suite to run.\"\n- **The Quality Assurance Engineer**: \"My team is struggling with flaky tests\nthat pass or fail unpredictably. `pytest-brightest`'s shuffling capabilities\nhelp us shine a light on these tests by breaking hidden dependencies, making our\ntest suite more reliable.\"\n- **The Open-Source Maintainer**: \"When a contributor submits a pull request, I\nwant to be confident it doesn't re-introduce old bugs. Reordering tests to run\npreviously failing ones first gives me a faster signal, streamlining my review\nprocess.\"\n\n## Why `pytest-brightest`?\n\nIn software testing, not all test executions are created equal. Some tests are\nlong, others are short. Some are prone to failure, while others are steadfastly\nreliable. `pytest-brightest` helps you shine a light on these characteristics\nto run your test suite more intelligently. It's not just about leveraging the\nbrightest ideas from software testing research; it's about making your `test`s\nbrighter (yes, the pun is intended!). Whether you want to get feedback faster,\nfind flaky tests, or simply bring more clarity to your testing chaos,\n`pytest-brightest` is here to help.\n\n## Requirements\n\nTo use `pytest-brightest`, you'll need:\n\n- `pytest`\n- `pytest-json-report`\n\n`pytest-brightest` uses the data generated by `pytest-json-report` to work its\nmagic. If you have `pytest-json-report` installed, `pytest-brightest` will\nautomatically configure it for you.\n\n## Installation\n\n### Using `uv`\n\nTo install `pytest-brightest` using `uv`, a fast Python package installer and\nresolver, run the following command:\n\n```bash\nuv add pytest-brightest --group dev\n```\n\n### Using `poetry`\n\nTo install `pytest-brightest` using `poetry`, a tool for dependency management\nand packaging in Python, run the following command:\n\n```bash\npoetry add pytest-brightest --group dev\n```\n\n## Modes of Operation\n\n`pytest-brightest` is enabled with the `--brightest` flag and can operate in\nseveral modes, configured through the `--reorder-by-technique` option.\n\n### Reordering\n\nYou can reorder your tests based on a variety of criteria:\n\n- **`cost`**: Reorders tests based on their execution time from the previous\nrun. This is perfect for getting quick feedback by running faster tests first.\n- **`name`**: Reorders tests alphabetically by their name.\n- **`failure`**: Reorders tests based on their failure history, running tests\nthat failed in the previous run first. This is a powerful technique for\nregression testing.\n\n### Shuffling\n\n- **`shuffle`**: Randomizes the order of your tests. This is an excellent way to\nuncover hidden dependencies between tests and identify \"flaky\" tests that pass\nor fail based on the order in which they are run.\n\n## Command-Line Arguments\n\nHere's a breakdown of the command-line arguments you can use to control\n`pytest-brightest`:\n\n- `--brightest`\n    - **Description**: Enable the `pytest-brightest` plugin.\n    - **Default**: `False`\n- `--reorder-by-technique`\n    - **Description**: The technique to use for reordering or shuffling tests.\n    - **Options**: `shuffle`, `name`, `cost`, `failure`\n    - **Default**: `None`\n- `--reorder-by-focus`\n    - **Description**: The scope of the reordering or shuffling.\n    - **Options**: `modules-within-suite`, `tests-within-module`,\n    `tests-across-modules`\n    - **Default**: `tests-across-modules`\n- `--reorder-in-direction`\n    - **Description**: The direction of the reordering.\n    - **Options**: `ascending`, `descending`\n    - **Default**: `ascending`\n- `--seed`\n    - **Description**: A seed for the random number generator used for\n    shuffling, ensuring reproducible results.\n    - **Default**: (random)\n\n### Examples\n\n#### Run faster tests first\n\n```bash\npytest --brightest --reorder-by-technique cost --reorder-in-direction ascending\n```\n\n#### Run previously failing tests first\n\n```bash\npytest --brightest --reorder-by-technique failure --reorder-in-direction descending\n```\n\n#### Shuffle all tests with a specific seed\n\n```bash\npytest --brightest --reorder-by-technique shuffle --seed 12345\n```\n\n#### Shuffle tests within each module, but keep the module order\n\n```bash\npytest --brightest --reorder-by-technique shuffle --reorder-by-focus tests-within-module\n```\n\n## Contributing and Reporting Issues\n\nContributions are welcome! This project is open-source and thrives on community\ninvolvement. Let's make testing brighter, together.\n\n- **Issues**: If you find a bug or have a feature request, please [open an\nissue](https://github.com/AstuteSource/pytest-brightest/issues).\n- **Pull Requests**: If you'd like to contribute code, please [submit a pull\nrequest](https://github.com/AstuteSource/pytest-brightest/pulls).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Bright ideas for improving your pytest experience",
    "version": "0.1.0",
    "project_urls": null,
    "split_keywords": [
        "llm",
        " pytest",
        " testing"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "ab03087e759fe096d84f21f7948429f54b166e5cbbe649fb3be55c6eccb8ee87",
                "md5": "08484cad8ca42f84dcb7689831714197",
                "sha256": "769216675a4d3e98da888a6670dcd50c583e571297fc601a0d148cd95214ac39"
            },
            "downloads": -1,
            "filename": "pytest_brightest-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08484cad8ca42f84dcb7689831714197",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 15467,
            "upload_time": "2025-07-15T22:43:14",
            "upload_time_iso_8601": "2025-07-15T22:43:14.413273Z",
            "url": "https://files.pythonhosted.org/packages/ab/03/087e759fe096d84f21f7948429f54b166e5cbbe649fb3be55c6eccb8ee87/pytest_brightest-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4cbebfbe4f1dac2c2b263af2bbc630da56e7f8da213232510cfc74699839b8fa",
                "md5": "d8e97d1188ee988eb86d8ac1b724f86d",
                "sha256": "3c916b4dbcb70c9c1cd918bb84d53a6057ac8dab800cb660066be446db2740fc"
            },
            "downloads": -1,
            "filename": "pytest_brightest-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "d8e97d1188ee988eb86d8ac1b724f86d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 152865,
            "upload_time": "2025-07-15T22:43:15",
            "upload_time_iso_8601": "2025-07-15T22:43:15.839770Z",
            "url": "https://files.pythonhosted.org/packages/4c/be/bfbe4f1dac2c2b263af2bbc630da56e7f8da213232510cfc74699839b8fa/pytest_brightest-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-15 22:43:15",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pytest-brightest"
}
        
Elapsed time: 2.14351s