pytest-sloppy-tools 0.2.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,79 @@
1
+ # docs.yml
2
+ # SPDX-License-Identifier: CC0-1.0
3
+ # This file was created by an AI model: openai/gpt-6.2-sol
4
+
5
+ name: Documentation
6
+
7
+ on:
8
+ push:
9
+ branches:
10
+ - master
11
+ pull_request:
12
+ branches:
13
+ - master
14
+ workflow_dispatch:
15
+
16
+ permissions: {}
17
+
18
+ concurrency:
19
+ group: documentation-${{ github.ref }}
20
+ cancel-in-progress: false
21
+
22
+ defaults:
23
+ run:
24
+ shell: bash
25
+
26
+ jobs:
27
+ build:
28
+ name: Build documentation
29
+ runs-on: ubuntu-24.04
30
+ timeout-minutes: 10
31
+ permissions:
32
+ contents: read
33
+ steps:
34
+ - name: Check out the triggering commit
35
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
36
+ with:
37
+ persist-credentials: false
38
+
39
+ - name: Set up uv and Python
40
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
41
+ with:
42
+ version: "0.13.7"
43
+ python-version: "3.13.5"
44
+ enable-cache: false
45
+
46
+ - name: Install locked documentation dependencies
47
+ run: uv sync --locked --no-dev --group docs
48
+
49
+ - name: Build with warnings treated as errors
50
+ run: uv run --locked --no-dev --group docs sphinx-build -M html docs docs/_build -n -W --keep-going
51
+
52
+ - name: Check executable documentation examples
53
+ run: uv run --locked --no-dev --group docs sphinx-build -M doctest docs docs/_build -n -W --keep-going
54
+
55
+ - name: Upload the Pages site
56
+ if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
57
+ uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
58
+ with:
59
+ name: github-pages
60
+ path: docs/_build/html
61
+
62
+ deploy:
63
+ name: Deploy GitHub Pages
64
+ needs: build
65
+ if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
66
+ runs-on: ubuntu-24.04
67
+ timeout-minutes: 10
68
+ permissions:
69
+ pages: write
70
+ id-token: write
71
+ environment:
72
+ name: github-pages
73
+ url: ${{ steps.deployment.outputs.page_url }}
74
+ steps:
75
+ - name: Deploy the built site
76
+ id: deployment
77
+ uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
78
+ with:
79
+ artifact_name: github-pages
@@ -0,0 +1,144 @@
1
+ # release.yml
2
+ # SPDX-License-Identifier: CC0-1.0
3
+ # This file was created by an AI model: openai/gpt-6.2-sol
4
+
5
+ name: Publish Python package
6
+ run-name: Publish ${{ github.ref_name }} to ${{ github.event_name == 'push' && 'pypi' || inputs.destination }}
7
+
8
+ on:
9
+ push:
10
+ tags:
11
+ - "v*"
12
+ workflow_dispatch:
13
+ inputs:
14
+ destination:
15
+ description: Package index
16
+ required: true
17
+ type: choice
18
+ default: test-pypi
19
+ options:
20
+ - test-pypi
21
+ - pypi
22
+
23
+ permissions: {}
24
+
25
+ concurrency:
26
+ group: release-${{ github.ref }}-${{ github.event_name == 'push' && 'pypi' || inputs.destination }}
27
+ cancel-in-progress: false
28
+
29
+ defaults:
30
+ run:
31
+ shell: bash
32
+
33
+ jobs:
34
+ validate-build:
35
+ name: Validate and build the tagged revision
36
+ runs-on: ubuntu-24.04
37
+ timeout-minutes: 20
38
+ permissions:
39
+ contents: read
40
+ outputs:
41
+ artifact-id: ${{ steps.distributions.outputs.artifact-id }}
42
+ destination: ${{ steps.release.outputs.destination }}
43
+ steps:
44
+ - name: Check out the triggering commit
45
+ uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
46
+ with:
47
+ ref: ${{ github.sha }}
48
+ persist-credentials: false
49
+
50
+ - name: Require a matching version tag and resolve the destination
51
+ id: release
52
+ env:
53
+ RELEASE_REF: ${{ github.ref }}
54
+ RELEASE_EVENT: ${{ github.event_name }}
55
+ RELEASE_DESTINATION: ${{ inputs.destination }}
56
+ run: |
57
+ python3 tests/check_release.py "$RELEASE_REF" \
58
+ --event "$RELEASE_EVENT" --destination "$RELEASE_DESTINATION" >> "$GITHUB_OUTPUT"
59
+
60
+ - name: Set up uv and Python
61
+ uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
62
+ with:
63
+ version: "0.13.7"
64
+ python-version: "3.13.5"
65
+ enable-cache: false
66
+
67
+ - name: Install checksum-pinned NVC
68
+ run: |
69
+ asset="nvc_1.21.1-1_amd64_ubuntu-24.04.deb"
70
+ package="$RUNNER_TEMP/$asset"
71
+ curl --fail --location --silent --show-error --retry 3 \
72
+ --proto '=https' --proto-redir '=https' \
73
+ --output "$package" \
74
+ "https://github.com/nickg/nvc/releases/download/r1.21.1/$asset"
75
+ printf '%s %s\n' \
76
+ 'a259847c86fe0e547c481b20686c62a97245a3d44d40d79b7f70ac7408e9bda6' \
77
+ "$package" | sha256sum --check --strict
78
+ sudo apt-get update
79
+ sudo apt-get install --yes --no-install-recommends "$package"
80
+ test "$(dpkg-query --show --showformat='${Version}' nvc)" = "1.21.1-1"
81
+ nvc --version
82
+
83
+ - name: Install locked development dependencies
84
+ run: uv sync --locked
85
+
86
+ - name: Check types
87
+ run: uv run --locked pyrefly check
88
+
89
+ - name: Check formatting
90
+ run: uv run --locked ruff format --check .
91
+
92
+ - name: Check lint
93
+ run: uv run --locked ruff check .
94
+
95
+ - name: Run Python and NVC tests
96
+ run: uv run --locked pytest -q
97
+
98
+ - name: Build and validate the release distributions
99
+ run: |
100
+ mkdir "$RUNNER_TEMP/release-dist"
101
+ uv build --no-sources --out-dir "$RUNNER_TEMP/release-dist"
102
+ uv run --locked python tests/test_distribution.py --dist "$RUNNER_TEMP/release-dist"
103
+ sha256sum "$RUNNER_TEMP/release-dist/"*.whl "$RUNNER_TEMP/release-dist/"*.tar.gz
104
+
105
+ - name: Save only the validated sdist and wheel
106
+ id: distributions
107
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
108
+ with:
109
+ name: release-distributions-${{ github.run_id }}-${{ github.run_attempt }}
110
+ path: |
111
+ ${{ runner.temp }}/release-dist/*.whl
112
+ ${{ runner.temp }}/release-dist/*.tar.gz
113
+ if-no-files-found: error
114
+ retention-days: 7
115
+
116
+ publish:
117
+ name: Publish validated distributions
118
+ needs: validate-build
119
+ if: needs.validate-build.outputs.destination == 'pypi' || needs.validate-build.outputs.destination == 'test-pypi'
120
+ runs-on: ubuntu-24.04
121
+ timeout-minutes: 10
122
+ environment:
123
+ name: ${{ needs.validate-build.outputs.destination }}
124
+ url: ${{ needs.validate-build.outputs.destination == 'pypi' && 'https://pypi.org/p/pytest-sloppy-tools' || 'https://test.pypi.org/p/pytest-sloppy-tools' }}
125
+ permissions:
126
+ id-token: write
127
+ steps:
128
+ # No checkout, dependency installation or package execution in this job.
129
+ - name: Download this run's validated distributions
130
+ uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
131
+ with:
132
+ artifact-ids: ${{ needs.validate-build.outputs.artifact-id }}
133
+ merge-multiple: true
134
+ path: dist/
135
+
136
+ - name: Publish with Trusted Publishing
137
+ uses: pypa/gh-action-pypi-publish@7245906fb61fa33a13554f9d5fb856fe61758086 # v1.14.3
138
+ with:
139
+ repository-url: ${{ needs.validate-build.outputs.destination == 'pypi' && 'https://upload.pypi.org/legacy/' || 'https://test.pypi.org/legacy/' }}
140
+ packages-dir: dist/
141
+ verify-metadata: true
142
+ attestations: true
143
+ print-hash: true
144
+ skip-existing: false
@@ -0,0 +1,12 @@
1
+ # .gitignore
2
+ # SPDX-License-Identifier: CC0-1.0
3
+ # This file was created by an AI model: openai/gpt-6.1-sol
4
+
5
+ .venv/
6
+ __pycache__/
7
+ *.py[cod]
8
+ .ruff_cache/
9
+ .pytest_cache/
10
+ sim_build/
11
+ dist/
12
+ docs/_build/
@@ -0,0 +1,47 @@
1
+ # Architecture
2
+
3
+ The plugin requires pytest at runtime. The optional `cocotb` extra installs
4
+ cocotb for users running simulations; the plugin itself does not import it.
5
+ The development dependency group includes cocotb for the NVC integration test.
6
+
7
+ The `pytest11` entry point registers a small, opt-in plugin. Serial runs use
8
+ pytest's own run loop. The parallel run loop starts after collection and
9
+ deselection finish, and forks the collected session on Linux. Workers each run an
10
+ ordered queue of item indices through pytest's test protocol. The queue builder
11
+ contains the round-robin scheduling policy; worker execution does not depend
12
+ on the policy. Each worker passes its actual next item to pytest so the fixture
13
+ manager can reuse broader-scoped fixtures in that process. Each worker uses a
14
+ subdirectory of the session's base temporary directory for pytest's `tmp_path`.
15
+
16
+ The controller owns the terminal and the session result. Each worker sends
17
+ lifecycle messages and pytest-serialised reports over a private connection. The
18
+ controller replays reports through pytest's reporting hooks and signals whether
19
+ the worker should continue once the current test finishes. Only the worker runs
20
+ the test and its fixture code.
21
+
22
+ Workers redirect stdout and stderr at the file descriptor level to a temporary
23
+ pair of files per item. The controller reads those files periodically for live
24
+ output or at item completion for batched output, and removes them after display.
25
+ The streams do not share the report connection and do not fill an IPC pipe
26
+ while the controller handles another worker. Separate files prevent a late
27
+ write to one item's descriptor from appearing under another item's label.
28
+ Worker capture fixtures stay active, and a Python logging handler sends records
29
+ to the worker's stderr.
30
+
31
+ The controller monitors the connections and child process status. A failed or
32
+ interrupted run stops and reaps the remaining workers. Each worker has its own
33
+ process group so cleanup can also signal its subprocesses.
34
+
35
+ `--pretty` installs an optional renderer for serial pytest and the parallel
36
+ controller. During the run loop it replaces the terminal reporter's progress
37
+ hooks and keeps pytest's report categories and summary hooks. The renderer
38
+ assigns a slot to each collected item, sizes the percentage column from the
39
+ labels and slot counts, and updates the row after teardown. In serial runs it
40
+ displays pytest's capture sections and ends the progress line before a capture
41
+ fixture sends output to the terminal. With workers it draws around the
42
+ controller's stream output. The child process never renders progress.
43
+
44
+ GitHub Actions builds the Sphinx site and deploys it to Pages from `master`.
45
+ The release workflow checks that the tag matches `pyproject.toml`, runs the
46
+ tests, and validates the built wheel and source distribution. A separate job
47
+ publishes those files with PyPI Trusted Publishing.
@@ -0,0 +1,121 @@
1
+ Creative Commons Legal Code
2
+
3
+ CC0 1.0 Universal
4
+
5
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12
+ HEREUNDER.
13
+
14
+ Statement of Purpose
15
+
16
+ The laws of most jurisdictions throughout the world automatically confer
17
+ exclusive Copyright and Related Rights (defined below) upon the creator
18
+ and subsequent owner(s) (each and all, an "owner") of an original work of
19
+ authorship and/or a database (each, a "Work").
20
+
21
+ Certain owners wish to permanently relinquish those rights to a Work for
22
+ the purpose of contributing to a commons of creative, cultural and
23
+ scientific works ("Commons") that the public can reliably and without fear
24
+ of later claims of infringement build upon, modify, incorporate in other
25
+ works, reuse and redistribute as freely as possible in any form whatsoever
26
+ and for any purposes, including without limitation commercial purposes.
27
+ These owners may contribute to the Commons to promote the ideal of a free
28
+ culture and the further production of creative, cultural and scientific
29
+ works, or to gain reputation or greater distribution for their Work in
30
+ part through the use and efforts of others.
31
+
32
+ For these and/or other purposes and motivations, and without any
33
+ expectation of additional consideration or compensation, the person
34
+ associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35
+ is an owner of Copyright and Related Rights in the Work, voluntarily
36
+ elects to apply CC0 to the Work and publicly distribute the Work under its
37
+ terms, with knowledge of his or her Copyright and Related Rights in the
38
+ Work and the meaning and intended legal effect of CC0 on those rights.
39
+
40
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
41
+ protected by copyright and related or neighboring rights ("Copyright and
42
+ Related Rights"). Copyright and Related Rights include, but are not
43
+ limited to, the following:
44
+
45
+ i. the right to reproduce, adapt, distribute, perform, display,
46
+ communicate, and translate a Work;
47
+ ii. moral rights retained by the original author(s) and/or performer(s);
48
+ iii. publicity and privacy rights pertaining to a person's image or
49
+ likeness depicted in a Work;
50
+ iv. rights protecting against unfair competition in regards to a Work,
51
+ subject to the limitations in paragraph 4(a), below;
52
+ v. rights protecting the extraction, dissemination, use and reuse of data
53
+ in a Work;
54
+ vi. database rights (such as those arising under Directive 96/9/EC of the
55
+ European Parliament and of the Council of 11 March 1996 on the legal
56
+ protection of databases, and under any national implementation
57
+ thereof, including any amended or successor version of such
58
+ directive); and
59
+ vii. other similar, equivalent or corresponding rights throughout the
60
+ world based on applicable law or treaty, and any national
61
+ implementations thereof.
62
+
63
+ 2. Waiver. To the greatest extent permitted by, but not in contravention
64
+ of, applicable law, Affirmer hereby overtly, fully, permanently,
65
+ irrevocably and unconditionally waives, abandons, and surrenders all of
66
+ Affirmer's Copyright and Related Rights and associated claims and causes
67
+ of action, whether now known or unknown (including existing as well as
68
+ future claims and causes of action), in the Work (i) in all territories
69
+ worldwide, (ii) for the maximum duration provided by applicable law or
70
+ treaty (including future time extensions), (iii) in any current or future
71
+ medium and for any number of copies, and (iv) for any purpose whatsoever,
72
+ including without limitation commercial, advertising or promotional
73
+ purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74
+ member of the public at large and to the detriment of Affirmer's heirs and
75
+ successors, fully intending that such Waiver shall not be subject to
76
+ revocation, rescission, cancellation, termination, or any other legal or
77
+ equitable action to disrupt the quiet enjoyment of the Work by the public
78
+ as contemplated by Affirmer's express Statement of Purpose.
79
+
80
+ 3. Public License Fallback. Should any part of the Waiver for any reason
81
+ be judged legally invalid or ineffective under applicable law, then the
82
+ Waiver shall be preserved to the maximum extent permitted taking into
83
+ account Affirmer's express Statement of Purpose. In addition, to the
84
+ extent the Waiver is so judged Affirmer hereby grants to each affected
85
+ person a royalty-free, non transferable, non sublicensable, non exclusive,
86
+ irrevocable and unconditional license to exercise Affirmer's Copyright and
87
+ Related Rights in the Work (i) in all territories worldwide, (ii) for the
88
+ maximum duration provided by applicable law or treaty (including future
89
+ time extensions), (iii) in any current or future medium and for any number
90
+ of copies, and (iv) for any purpose whatsoever, including without
91
+ limitation commercial, advertising or promotional purposes (the
92
+ "License"). The License shall be deemed effective as of the date CC0 was
93
+ applied by Affirmer to the Work. Should any part of the License for any
94
+ reason be judged legally invalid or ineffective under applicable law, such
95
+ partial invalidity or ineffectiveness shall not invalidate the remainder
96
+ of the License, and in such case Affirmer hereby affirms that he or she
97
+ will not (i) exercise any of his or her remaining Copyright and Related
98
+ Rights in the Work or (ii) assert any associated claims and causes of
99
+ action with respect to the Work, in either case contrary to Affirmer's
100
+ express Statement of Purpose.
101
+
102
+ 4. Limitations and Disclaimers.
103
+
104
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
105
+ surrendered, licensed or otherwise affected by this document.
106
+ b. Affirmer offers the Work as-is and makes no representations or
107
+ warranties of any kind concerning the Work, express, implied,
108
+ statutory or otherwise, including without limitation warranties of
109
+ title, merchantability, fitness for a particular purpose, non
110
+ infringement, or the absence of latent or other defects, accuracy, or
111
+ the present or absence of errors, whether or not discoverable, all to
112
+ the greatest extent permissible under applicable law.
113
+ c. Affirmer disclaims responsibility for clearing rights of other persons
114
+ that may apply to the Work or any use thereof, including without
115
+ limitation any person's Copyright and Related Rights in the Work.
116
+ Further, Affirmer disclaims responsibility for obtaining any necessary
117
+ consents, permissions or other rights required for any use of the
118
+ Work.
119
+ d. Affirmer understands and acknowledges that Creative Commons is not a
120
+ party to this document and has no duty or obligation with respect to
121
+ this CC0 or use of the Work.
@@ -0,0 +1,37 @@
1
+ Metadata-Version: 2.5
2
+ Name: pytest-sloppy-tools
3
+ Version: 0.2.1
4
+ Summary: Helpers and fixtures for pytest workflows
5
+ License-Expression: CC0-1.0
6
+ License-File: LICENSE.txt
7
+ Requires-Python: >=3.13
8
+ Requires-Dist: pytest<10,>=9
9
+ Provides-Extra: cocotb
10
+ Requires-Dist: cocotb>=2.1.0; extra == 'cocotb'
11
+ Description-Content-Type: text/markdown
12
+
13
+ # pytest-sloppy-tools
14
+
15
+ Helpers and fixtures for pytest workflows, including parallel execution for suites
16
+ that launch cocotb simulations.
17
+
18
+ Install from this checkout in a Python 3.13 environment with `uv sync --no-dev`.
19
+ The parallel runner works without cocotb. Add `--extra cocotb` to `uv sync` or
20
+ `uv run` to install cocotb if your tests need it. For development, `uv sync`
21
+ includes cocotb for the simulator integration test, which also requires Linux
22
+ and NVC.
23
+
24
+ Parallel execution is **Linux only**. To run four workers, choose an output mode:
25
+
26
+ ```sh
27
+ uv run --no-dev pytest --workers=4 --output=live --log-cli-level=INFO
28
+ uv run --no-dev pytest --workers=4 --output=batched --log-cli-level=INFO
29
+ ```
30
+
31
+ Each parametrised case is scheduled separately. Output is labelled with its test
32
+ ID and stream, including output from subprocesses that inherit stdout and stderr.
33
+ Omit both options to run pytest normally.
34
+
35
+ Add [`--pretty`](docs/pretty.md) for compact, coloured progress in serial or
36
+ parallel runs. See the [parallel execution guide](docs/parallel.md) for logging,
37
+ fixtures, and simulator build-directory isolation.
@@ -0,0 +1,25 @@
1
+ # pytest-sloppy-tools
2
+
3
+ Helpers and fixtures for pytest workflows, including parallel execution for suites
4
+ that launch cocotb simulations.
5
+
6
+ Install from this checkout in a Python 3.13 environment with `uv sync --no-dev`.
7
+ The parallel runner works without cocotb. Add `--extra cocotb` to `uv sync` or
8
+ `uv run` to install cocotb if your tests need it. For development, `uv sync`
9
+ includes cocotb for the simulator integration test, which also requires Linux
10
+ and NVC.
11
+
12
+ Parallel execution is **Linux only**. To run four workers, choose an output mode:
13
+
14
+ ```sh
15
+ uv run --no-dev pytest --workers=4 --output=live --log-cli-level=INFO
16
+ uv run --no-dev pytest --workers=4 --output=batched --log-cli-level=INFO
17
+ ```
18
+
19
+ Each parametrised case is scheduled separately. Output is labelled with its test
20
+ ID and stream, including output from subprocesses that inherit stdout and stderr.
21
+ Omit both options to run pytest normally.
22
+
23
+ Add [`--pretty`](docs/pretty.md) for compact, coloured progress in serial or
24
+ parallel runs. See the [parallel execution guide](docs/parallel.md) for logging,
25
+ fixtures, and simulator build-directory isolation.
@@ -0,0 +1,8 @@
1
+ # conf.py
2
+ # SPDX-License-Identifier: CC0-1.0
3
+ # This file was created by an AI model: openai/gpt-6.2-sol
4
+
5
+ project = "pytest-sloppy-tools"
6
+ extensions = ["myst_parser", "sphinx.ext.doctest"]
7
+ exclude_patterns = ["_build"]
8
+ html_theme = "furo"
@@ -0,0 +1,10 @@
1
+ # pytest-sloppy-tools
2
+
3
+ Helpers and fixtures for pytest workflows.
4
+
5
+ ```{toctree}
6
+ :maxdepth: 2
7
+
8
+ parallel
9
+ pretty
10
+ ```
@@ -0,0 +1,64 @@
1
+ # Parallel execution
2
+
3
+ Parallel execution requires **Linux** with `/proc` available. The plugin collects
4
+ tests once, then forks worker processes from the collected session. Running pytest
5
+ without the parallel options leaves its normal execution and capture settings
6
+ unchanged.
7
+
8
+ ```sh
9
+ uv run --no-dev pytest --workers=4 --output=live --log-cli-level=INFO
10
+ uv run --no-dev pytest --workers=4 --output=batched --log-cli-level=INFO
11
+ ```
12
+
13
+ `--workers=N` starts up to `N` workers. `--output` is required for a parallel
14
+ run; neither mode is the default. The runner does not require cocotb. If your
15
+ tests use cocotb, install it separately or pass `--extra cocotb` to `uv run`.
16
+
17
+ ## Output and logs
18
+
19
+ In `live` mode, the controller displays output as the worker flushes it. For
20
+ subprocesses that buffer their output, configure the subprocess to flush or run
21
+ unbuffered. In `batched` mode, the controller displays a test's output together
22
+ after its setup, call, and teardown finish. Both modes display output for passing
23
+ and failing tests and label stdout and stderr with the pytest node ID. Output
24
+ within each stream is displayed in order; ordering between stdout and stderr is
25
+ not guaranteed. The controller is the only process that displays pytest progress
26
+ and the final summary.
27
+
28
+ Python logging records that reach the root logger are written to the test's
29
+ stderr stream. The display level comes from `log_cli_level` (for example,
30
+ `--log-cli-level=INFO`), then `log_level`, and defaults to `WARNING`. Log records
31
+ also remain available through `caplog` and pytest's report sections. Existing
32
+ console log handlers may display the same record a second time.
33
+
34
+ The plugin uses its own worker output capture, including native writes and
35
+ subprocesses that inherit the worker's stdout and stderr. `capsys` and `capfd`
36
+ still work: output consumed by a capture fixture does not appear on the terminal.
37
+ The worker streams are for terminal display, not for pytest's captured stdout
38
+ and stderr report sections or JUnit attachments. Warnings emitted during a test
39
+ appear with its stderr unless you pass `--disable-warnings`.
40
+
41
+ ## Scheduling and fixtures
42
+
43
+ Each collected item, including every parametrised case, is scheduled
44
+ independently. The runner distributes items round-robin and runs each worker's
45
+ items in collection order. It does not move queued items to an idle worker.
46
+ Module- and session-scoped fixtures are local to each worker using them, so a
47
+ simulator build in a module-scoped fixture can run more than once.
48
+
49
+ Use pytest's `tmp_path` fixture for per-test cocotb build directories, or use
50
+ `tmp_path_factory.mktemp(...)` for a build reused within a worker. Do not have
51
+ parallel tests write to the same build or result directory. Wait for any
52
+ subprocesses the test starts before it ends so their output reaches the terminal.
53
+
54
+ ## Limitations
55
+
56
+ Imports and collection hooks must not leave background threads running when
57
+ workers fork. Tests that require interactive input, pytest's interactive debugger,
58
+ or xdist distribution must run separately. Plugins that depend on all test hooks
59
+ and session hooks running in the same process may not work: test execution hooks
60
+ run in the workers and the controller replays their reports.
61
+
62
+ When `-x` or `--maxfail` triggers, tests that already started finish and workers
63
+ stop taking new items. If a worker crashes, pytest reports the crash and terminates
64
+ the other workers.
@@ -0,0 +1,35 @@
1
+ # Pretty progress
2
+
3
+ Use `--pretty` to replace pytest's progress display in serial and parallel runs:
4
+
5
+ ```sh
6
+ uv run --no-dev pytest --pretty
7
+ uv run --no-dev pytest --pretty --workers=4 --output=live
8
+ ```
9
+
10
+ Each row uses the function name, with a module or class qualifier if names
11
+ collide. Parametrised cases share a row and their marks follow collection order,
12
+ even when workers finish out of order. The percentage counts completed items
13
+ across the whole run, including teardown. Percentages share a right-aligned
14
+ column with 12 spaces between the longest possible row and the percentage field.
15
+
16
+ | Mark | Outcome | Colour |
17
+ | --- | --- | --- |
18
+ | `·` | Passed | Green |
19
+ | `×` | Failed, including setup or teardown errors | Red |
20
+ | `s` | Skipped | Yellow |
21
+ | `x` / `X` | Expected failure / unexpected pass | Yellow |
22
+
23
+ On a terminal, a quiet case updates its row in place when it fits. Test output
24
+ starts on its own line; when the row continues, marks on earlier lines are dimmed
25
+ and new marks keep their colours. Parallel runs honour both `--output=live` and
26
+ `--output=batched`. Serial runs show captured stdout, stderr, and logs after
27
+ each test. With `-s`, `--capture=sys`, `--capture=tee-sys`, or pytest's live
28
+ logging, progress uses a separate line after each test to leave room for output
29
+ that goes directly to the terminal.
30
+
31
+ Redirected output uses plain lines without cursor movement. Quiet cases are
32
+ grouped on one line per function when progress doesn't need to make room for
33
+ output. Colours follow pytest's `--color` setting. Pytest still prints its
34
+ regular tracebacks and summary. Use `--show-capture=no` to avoid repeating
35
+ captured output in failure details. `--pretty` does not support xdist distribution.
@@ -0,0 +1,44 @@
1
+ # pyproject.toml
2
+ # SPDX-License-Identifier: CC0-1.0
3
+ # This file was created by an AI model: openai/gpt-6.2-sol
4
+
5
+ [build-system]
6
+ requires = ["hatchling"]
7
+ build-backend = "hatchling.build"
8
+
9
+ [project]
10
+ name = "pytest-sloppy-tools"
11
+ version = "0.2.1"
12
+ description = "Helpers and fixtures for pytest workflows"
13
+ readme = "README.md"
14
+ requires-python = ">=3.13"
15
+ license = "CC0-1.0"
16
+ license-files = ["LICENSE.txt"]
17
+ dependencies = ["pytest>=9,<10"]
18
+
19
+ [project.optional-dependencies]
20
+ cocotb = ["cocotb>=2.1.0"]
21
+
22
+ [project.entry-points.pytest11]
23
+ sloppy_tools = "pytest_sloppy_tools._parallel"
24
+
25
+ [dependency-groups]
26
+ dev = ["cocotb>=2.1.0", "pyrefly", "ruff"]
27
+ docs = ["furo", "myst-parser", "sphinx"]
28
+
29
+ [tool.ruff]
30
+ line-length = 120
31
+
32
+ [tool.ruff.lint]
33
+ ignore = ["I001", "BLE001"]
34
+
35
+ [tool.ruff.lint.isort]
36
+ force-single-line = true
37
+ from-first = false
38
+ length-sort = true
39
+ no-sections = true
40
+
41
+ [tool.ruff.format]
42
+ quote-style = "double"
43
+ indent-style = "tab"
44
+ docstring-code-format = true
@@ -0,0 +1,5 @@
1
+ # __init__.py
2
+ # SPDX-License-Identifier: CC0-1.0
3
+ # This file was created by an AI model: openai/gpt-6.2-sol
4
+
5
+ """Helpers for pytest workflows."""