testless 0.1.5__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.
- testless-0.1.5/LICENSE +201 -0
- testless-0.1.5/PKG-INFO +185 -0
- testless-0.1.5/README.md +155 -0
- testless-0.1.5/pyproject.toml +93 -0
- testless-0.1.5/setup.cfg +4 -0
- testless-0.1.5/src/testless/__init__.py +3 -0
- testless-0.1.5/src/testless/analyze/__init__.py +0 -0
- testless-0.1.5/src/testless/analyze/dead_tests.py +44 -0
- testless-0.1.5/src/testless/analyze/duplicate_tests.py +102 -0
- testless-0.1.5/src/testless/analyze/missing_tests.py +98 -0
- testless-0.1.5/src/testless/analyze/refactor_candidates.py +87 -0
- testless-0.1.5/src/testless/analyze/service_risk.py +41 -0
- testless-0.1.5/src/testless/cli.py +306 -0
- testless-0.1.5/src/testless/collect/__init__.py +0 -0
- testless-0.1.5/src/testless/collect/coverage_loader.py +45 -0
- testless-0.1.5/src/testless/collect/endpoint_inventory.py +106 -0
- testless-0.1.5/src/testless/collect/fixture_index.py +72 -0
- testless-0.1.5/src/testless/collect/pytest_runner.py +76 -0
- testless-0.1.5/src/testless/config.py +56 -0
- testless-0.1.5/src/testless/models/__init__.py +0 -0
- testless-0.1.5/src/testless/models/coverage_map.py +58 -0
- testless-0.1.5/src/testless/models/findings.py +69 -0
- testless-0.1.5/src/testless/models/planfile.py +70 -0
- testless-0.1.5/src/testless/reporters/__init__.py +0 -0
- testless-0.1.5/src/testless/reporters/console.py +60 -0
- testless-0.1.5/src/testless/reporters/json.py +19 -0
- testless-0.1.5/src/testless/reporters/markdown.py +58 -0
- testless-0.1.5/src/testless/suggest/__init__.py +0 -0
- testless-0.1.5/src/testless/suggest/e2e.py +42 -0
- testless-0.1.5/src/testless/suggest/service_tests.py +35 -0
- testless-0.1.5/src/testless/suggest/smoke.py +42 -0
- testless-0.1.5/src/testless/suggest/testql.py +43 -0
- testless-0.1.5/src/testless/tickets/__init__.py +0 -0
- testless-0.1.5/src/testless/tickets/builder.py +186 -0
- testless-0.1.5/src/testless/tickets/prompts.py +42 -0
- testless-0.1.5/src/testless/tickets/serializer.py +33 -0
- testless-0.1.5/src/testless.egg-info/PKG-INFO +185 -0
- testless-0.1.5/src/testless.egg-info/SOURCES.txt +49 -0
- testless-0.1.5/src/testless.egg-info/dependency_links.txt +1 -0
- testless-0.1.5/src/testless.egg-info/entry_points.txt +2 -0
- testless-0.1.5/src/testless.egg-info/requires.txt +14 -0
- testless-0.1.5/src/testless.egg-info/top_level.txt +1 -0
- testless-0.1.5/tests/test_cli.py +65 -0
- testless-0.1.5/tests/test_collectors.py +118 -0
- testless-0.1.5/tests/test_config.py +39 -0
- testless-0.1.5/tests/test_coverage_loader.py +72 -0
- testless-0.1.5/tests/test_dead_tests.py +45 -0
- testless-0.1.5/tests/test_duplicate_tests.py +61 -0
- testless-0.1.5/tests/test_missing_tests.py +48 -0
- testless-0.1.5/tests/test_models.py +115 -0
- testless-0.1.5/tests/test_tickets.py +81 -0
testless-0.1.5/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
testless-0.1.5/PKG-INFO
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: testless
|
|
3
|
+
Version: 0.1.5
|
|
4
|
+
Summary: Analyze test value, coverage, duplication, and generate LLM planfiles
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Keywords: testing,coverage,analysis,llm,planfile
|
|
7
|
+
Classifier: Development Status :: 3 - Alpha
|
|
8
|
+
Classifier: Intended Audience :: Developers
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Topic :: Software Development :: Testing
|
|
13
|
+
Requires-Python: >=3.11
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
Requires-Dist: click>=8.1
|
|
17
|
+
Requires-Dist: coverage>=7.0
|
|
18
|
+
Requires-Dist: pytest>=8.0
|
|
19
|
+
Requires-Dist: pytest-cov>=5.0
|
|
20
|
+
Requires-Dist: pydantic>=2.7
|
|
21
|
+
Requires-Dist: PyYAML>=6.0
|
|
22
|
+
Requires-Dist: networkx>=3.0
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: ruff>=0.4; extra == "dev"
|
|
25
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
26
|
+
Requires-Dist: goal>=2.1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: costs>=0.1.20; extra == "dev"
|
|
28
|
+
Requires-Dist: pfix>=0.1.60; extra == "dev"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
# testless
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## AI Cost Tracking
|
|
35
|
+
|
|
36
|
+
   
|
|
37
|
+
  
|
|
38
|
+
|
|
39
|
+
- 🤖 **LLM usage:** $0.5874 (6 commits)
|
|
40
|
+
- 👤 **Human dev:** ~$300 (3.0h @ $100/h, 30min dedup)
|
|
41
|
+
|
|
42
|
+
Generated on 2026-05-24 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
**testless** is a Python package that sits as an analytical layer on top of your existing test suite.
|
|
47
|
+
It analyses test **value**, **coverage overlap**, **duplication**, and **missing gaps**, then generates
|
|
48
|
+
LLM-ready **planfile** tickets that describe exactly what to remove, refactor, or add.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Features
|
|
53
|
+
|
|
54
|
+
| Command | What it does |
|
|
55
|
+
|---------|--------------|
|
|
56
|
+
| `testless scan` | Run pytest with `--cov-context=test` and collect metadata |
|
|
57
|
+
| `testless duplicates` | Detect duplicate tests (coverage + AST + fixture overlap) |
|
|
58
|
+
| `testless missing` | Suggest smoke, e2e, contract, and TestQL tests |
|
|
59
|
+
| `testless planfiles` | Generate YAML planfile tickets for an LLM |
|
|
60
|
+
| `testless doctor` | Answer questions: "what to remove?", "what to add?" |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Quick Start
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install testless
|
|
68
|
+
# or with uv:
|
|
69
|
+
uv add --dev testless
|
|
70
|
+
|
|
71
|
+
# 1. Scan your project
|
|
72
|
+
testless scan
|
|
73
|
+
|
|
74
|
+
# 2. Find duplicate tests (threshold: 85 % similarity)
|
|
75
|
+
testless duplicates --min-overlap 0.85
|
|
76
|
+
|
|
77
|
+
# 3. Find missing smoke / service / e2e tests
|
|
78
|
+
testless missing --services src/myapp
|
|
79
|
+
|
|
80
|
+
# 4. Generate LLM planfiles
|
|
81
|
+
testless planfiles --out .planfiles/ --with-prompts
|
|
82
|
+
|
|
83
|
+
# 5. Ask doctor questions
|
|
84
|
+
testless doctor "which tests should I remove?"
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Configuration
|
|
90
|
+
|
|
91
|
+
Create a `.testless.yml` in your project root:
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
packages:
|
|
95
|
+
- myapp
|
|
96
|
+
|
|
97
|
+
test_dirs:
|
|
98
|
+
- tests
|
|
99
|
+
|
|
100
|
+
min_duplicate_score: 0.85
|
|
101
|
+
planfiles_dir: .planfiles
|
|
102
|
+
coverage_dir: .coverage_data
|
|
103
|
+
|
|
104
|
+
pytest_args:
|
|
105
|
+
- --tb=short
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Planfile format
|
|
111
|
+
|
|
112
|
+
Each generated ticket is a self-contained YAML file that an LLM can act on:
|
|
113
|
+
|
|
114
|
+
```yaml
|
|
115
|
+
version: "1"
|
|
116
|
+
kind: duplicate
|
|
117
|
+
id: "DUP-3A7F2C"
|
|
118
|
+
title: "Remove duplicate test: test_health_ok vs test_health_status_200"
|
|
119
|
+
goal: "Reduce test suite redundancy without losing unique coverage"
|
|
120
|
+
context:
|
|
121
|
+
test_a: tests/api/test_health.py::test_health_ok
|
|
122
|
+
test_b: tests/api/test_health.py::test_health_status_200
|
|
123
|
+
evidence:
|
|
124
|
+
- description: "score=0.93, coverage_overlap=0.95"
|
|
125
|
+
score: 0.93
|
|
126
|
+
impact:
|
|
127
|
+
risk: low
|
|
128
|
+
expected_gains:
|
|
129
|
+
- shorter test run time
|
|
130
|
+
- reduced maintenance burden
|
|
131
|
+
tasks:
|
|
132
|
+
- description: Compare test_health_ok and test_health_status_200 manually
|
|
133
|
+
- description: Remove the weaker/less descriptive test
|
|
134
|
+
- description: Run suite and verify no coverage regression
|
|
135
|
+
acceptance_criteria:
|
|
136
|
+
- No decrease in unique line coverage
|
|
137
|
+
- All remaining tests pass
|
|
138
|
+
llm_hints:
|
|
139
|
+
style: minimal change
|
|
140
|
+
safe_refactor: true
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Architecture
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
src/testless/
|
|
149
|
+
├── cli.py # Click CLI
|
|
150
|
+
├── config.py # .testless.yml loader
|
|
151
|
+
├── models/
|
|
152
|
+
│ ├── planfile.py # Pydantic Planfile model
|
|
153
|
+
│ ├── findings.py # Finding models
|
|
154
|
+
│ └── coverage_map.py # CoverageMap model
|
|
155
|
+
├── collect/
|
|
156
|
+
│ ├── pytest_runner.py # Run pytest, collect metadata
|
|
157
|
+
│ ├── coverage_loader.py # Parse coverage.json contexts
|
|
158
|
+
│ ├── fixture_index.py # AST-based fixture indexer
|
|
159
|
+
│ └── endpoint_inventory.py # HTTP endpoint/service scanner
|
|
160
|
+
├── analyze/
|
|
161
|
+
│ ├── duplicate_tests.py # Duplicate detection
|
|
162
|
+
│ ├── dead_tests.py # Dead test detection
|
|
163
|
+
│ ├── missing_tests.py # Missing test suggestions
|
|
164
|
+
│ ├── service_risk.py # Service risk scoring
|
|
165
|
+
│ └── refactor_candidates.py # Refactor detection
|
|
166
|
+
├── suggest/
|
|
167
|
+
│ ├── smoke.py # Smoke test templates
|
|
168
|
+
│ ├── e2e.py # E2E test templates
|
|
169
|
+
│ ├── service_tests.py # Service contract templates
|
|
170
|
+
│ └── testql.py # TestQL stub generator
|
|
171
|
+
├── tickets/
|
|
172
|
+
│ ├── builder.py # Build Planfile from findings
|
|
173
|
+
│ ├── serializer.py # Write planfiles to disk
|
|
174
|
+
│ └── prompts.py # Attach LLM prompts
|
|
175
|
+
└── reporters/
|
|
176
|
+
├── console.py # Coloured terminal output
|
|
177
|
+
├── markdown.py # Markdown report
|
|
178
|
+
└── json.py # JSON report
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
## License
|
|
184
|
+
|
|
185
|
+
Licensed under Apache-2.0.
|
testless-0.1.5/README.md
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# testless
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
## AI Cost Tracking
|
|
5
|
+
|
|
6
|
+
   
|
|
7
|
+
  
|
|
8
|
+
|
|
9
|
+
- 🤖 **LLM usage:** $0.5874 (6 commits)
|
|
10
|
+
- 👤 **Human dev:** ~$300 (3.0h @ $100/h, 30min dedup)
|
|
11
|
+
|
|
12
|
+
Generated on 2026-05-24 using [openrouter/qwen/qwen3-coder-next](https://openrouter.ai/qwen/qwen3-coder-next)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
**testless** is a Python package that sits as an analytical layer on top of your existing test suite.
|
|
17
|
+
It analyses test **value**, **coverage overlap**, **duplication**, and **missing gaps**, then generates
|
|
18
|
+
LLM-ready **planfile** tickets that describe exactly what to remove, refactor, or add.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
| Command | What it does |
|
|
25
|
+
|---------|--------------|
|
|
26
|
+
| `testless scan` | Run pytest with `--cov-context=test` and collect metadata |
|
|
27
|
+
| `testless duplicates` | Detect duplicate tests (coverage + AST + fixture overlap) |
|
|
28
|
+
| `testless missing` | Suggest smoke, e2e, contract, and TestQL tests |
|
|
29
|
+
| `testless planfiles` | Generate YAML planfile tickets for an LLM |
|
|
30
|
+
| `testless doctor` | Answer questions: "what to remove?", "what to add?" |
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install testless
|
|
38
|
+
# or with uv:
|
|
39
|
+
uv add --dev testless
|
|
40
|
+
|
|
41
|
+
# 1. Scan your project
|
|
42
|
+
testless scan
|
|
43
|
+
|
|
44
|
+
# 2. Find duplicate tests (threshold: 85 % similarity)
|
|
45
|
+
testless duplicates --min-overlap 0.85
|
|
46
|
+
|
|
47
|
+
# 3. Find missing smoke / service / e2e tests
|
|
48
|
+
testless missing --services src/myapp
|
|
49
|
+
|
|
50
|
+
# 4. Generate LLM planfiles
|
|
51
|
+
testless planfiles --out .planfiles/ --with-prompts
|
|
52
|
+
|
|
53
|
+
# 5. Ask doctor questions
|
|
54
|
+
testless doctor "which tests should I remove?"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
Create a `.testless.yml` in your project root:
|
|
62
|
+
|
|
63
|
+
```yaml
|
|
64
|
+
packages:
|
|
65
|
+
- myapp
|
|
66
|
+
|
|
67
|
+
test_dirs:
|
|
68
|
+
- tests
|
|
69
|
+
|
|
70
|
+
min_duplicate_score: 0.85
|
|
71
|
+
planfiles_dir: .planfiles
|
|
72
|
+
coverage_dir: .coverage_data
|
|
73
|
+
|
|
74
|
+
pytest_args:
|
|
75
|
+
- --tb=short
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Planfile format
|
|
81
|
+
|
|
82
|
+
Each generated ticket is a self-contained YAML file that an LLM can act on:
|
|
83
|
+
|
|
84
|
+
```yaml
|
|
85
|
+
version: "1"
|
|
86
|
+
kind: duplicate
|
|
87
|
+
id: "DUP-3A7F2C"
|
|
88
|
+
title: "Remove duplicate test: test_health_ok vs test_health_status_200"
|
|
89
|
+
goal: "Reduce test suite redundancy without losing unique coverage"
|
|
90
|
+
context:
|
|
91
|
+
test_a: tests/api/test_health.py::test_health_ok
|
|
92
|
+
test_b: tests/api/test_health.py::test_health_status_200
|
|
93
|
+
evidence:
|
|
94
|
+
- description: "score=0.93, coverage_overlap=0.95"
|
|
95
|
+
score: 0.93
|
|
96
|
+
impact:
|
|
97
|
+
risk: low
|
|
98
|
+
expected_gains:
|
|
99
|
+
- shorter test run time
|
|
100
|
+
- reduced maintenance burden
|
|
101
|
+
tasks:
|
|
102
|
+
- description: Compare test_health_ok and test_health_status_200 manually
|
|
103
|
+
- description: Remove the weaker/less descriptive test
|
|
104
|
+
- description: Run suite and verify no coverage regression
|
|
105
|
+
acceptance_criteria:
|
|
106
|
+
- No decrease in unique line coverage
|
|
107
|
+
- All remaining tests pass
|
|
108
|
+
llm_hints:
|
|
109
|
+
style: minimal change
|
|
110
|
+
safe_refactor: true
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Architecture
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
src/testless/
|
|
119
|
+
├── cli.py # Click CLI
|
|
120
|
+
├── config.py # .testless.yml loader
|
|
121
|
+
├── models/
|
|
122
|
+
│ ├── planfile.py # Pydantic Planfile model
|
|
123
|
+
│ ├── findings.py # Finding models
|
|
124
|
+
│ └── coverage_map.py # CoverageMap model
|
|
125
|
+
├── collect/
|
|
126
|
+
│ ├── pytest_runner.py # Run pytest, collect metadata
|
|
127
|
+
│ ├── coverage_loader.py # Parse coverage.json contexts
|
|
128
|
+
│ ├── fixture_index.py # AST-based fixture indexer
|
|
129
|
+
│ └── endpoint_inventory.py # HTTP endpoint/service scanner
|
|
130
|
+
├── analyze/
|
|
131
|
+
│ ├── duplicate_tests.py # Duplicate detection
|
|
132
|
+
│ ├── dead_tests.py # Dead test detection
|
|
133
|
+
│ ├── missing_tests.py # Missing test suggestions
|
|
134
|
+
│ ├── service_risk.py # Service risk scoring
|
|
135
|
+
│ └── refactor_candidates.py # Refactor detection
|
|
136
|
+
├── suggest/
|
|
137
|
+
│ ├── smoke.py # Smoke test templates
|
|
138
|
+
│ ├── e2e.py # E2E test templates
|
|
139
|
+
│ ├── service_tests.py # Service contract templates
|
|
140
|
+
│ └── testql.py # TestQL stub generator
|
|
141
|
+
├── tickets/
|
|
142
|
+
│ ├── builder.py # Build Planfile from findings
|
|
143
|
+
│ ├── serializer.py # Write planfiles to disk
|
|
144
|
+
│ └── prompts.py # Attach LLM prompts
|
|
145
|
+
└── reporters/
|
|
146
|
+
├── console.py # Coloured terminal output
|
|
147
|
+
├── markdown.py # Markdown report
|
|
148
|
+
└── json.py # JSON report
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
Licensed under Apache-2.0.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "testless"
|
|
7
|
+
version = "0.1.5"
|
|
8
|
+
description = "Analyze test value, coverage, duplication, and generate LLM planfiles"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "Apache-2.0"
|
|
12
|
+
keywords = ["testing", "coverage", "analysis", "llm", "planfile"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 3 - Alpha",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Topic :: Software Development :: Testing",
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"click>=8.1",
|
|
23
|
+
"coverage>=7.0",
|
|
24
|
+
"pytest>=8.0",
|
|
25
|
+
"pytest-cov>=5.0",
|
|
26
|
+
"pydantic>=2.7",
|
|
27
|
+
"PyYAML>=6.0",
|
|
28
|
+
"networkx>=3.0",
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = [
|
|
33
|
+
"ruff>=0.4",
|
|
34
|
+
"mypy>=1.10",
|
|
35
|
+
"goal>=2.1.0",
|
|
36
|
+
"costs>=0.1.20",
|
|
37
|
+
"pfix>=0.1.60",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.scripts]
|
|
41
|
+
testless = "testless.cli:main"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
where = ["src"]
|
|
45
|
+
|
|
46
|
+
[tool.pytest.ini_options]
|
|
47
|
+
testpaths = ["tests"]
|
|
48
|
+
addopts = "-v"
|
|
49
|
+
filterwarnings = [
|
|
50
|
+
"ignore::pytest.PytestCollectionWarning",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[tool.ruff]
|
|
54
|
+
src = ["src"]
|
|
55
|
+
line-length = 100
|
|
56
|
+
target-version = "py311"
|
|
57
|
+
|
|
58
|
+
[tool.ruff.lint]
|
|
59
|
+
select = ["E", "F", "W", "I"]
|
|
60
|
+
|
|
61
|
+
[tool.mypy]
|
|
62
|
+
python_version = "3.11"
|
|
63
|
+
strict = false
|
|
64
|
+
warn_unused_configs = true
|
|
65
|
+
|
|
66
|
+
[tool.pfix]
|
|
67
|
+
# Self-healing Python configuration
|
|
68
|
+
model = "openrouter/qwen/qwen3-coder-next"
|
|
69
|
+
auto_apply = true
|
|
70
|
+
auto_install_deps = true
|
|
71
|
+
auto_restart = false
|
|
72
|
+
max_retries = 3
|
|
73
|
+
create_backups = false
|
|
74
|
+
git_auto_commit = false
|
|
75
|
+
|
|
76
|
+
[tool.pfix.runtime_todo]
|
|
77
|
+
enabled = true
|
|
78
|
+
todo_file = "TODO.md"
|
|
79
|
+
min_severity = "low"
|
|
80
|
+
deduplicate = true
|
|
81
|
+
|
|
82
|
+
[tool.costs]
|
|
83
|
+
# AI Cost tracking configuration
|
|
84
|
+
badge = true
|
|
85
|
+
update_readme = true
|
|
86
|
+
readme_path = "README.md"
|
|
87
|
+
default_model = "openrouter/qwen/qwen3-coder-next"
|
|
88
|
+
analysis_mode = "byok"
|
|
89
|
+
full_history = true
|
|
90
|
+
max_commits = 500
|
|
91
|
+
|
|
92
|
+
# Cost thresholds for badge colors (USD)
|
|
93
|
+
badge_color_thresholds = { low = 1.0, medium = 5.0, high = 10.0, critical = 50.0 }
|
testless-0.1.5/setup.cfg
ADDED
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"""Detect tests that contribute no unique coverage."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from testless.models.coverage_map import CoverageMap
|
|
6
|
+
from testless.models.findings import DeadTestFinding, TestMeta
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def find_dead_tests(
|
|
10
|
+
tests: list[TestMeta],
|
|
11
|
+
cov_map: CoverageMap,
|
|
12
|
+
min_unique_lines: int = 1,
|
|
13
|
+
) -> list[DeadTestFinding]:
|
|
14
|
+
"""
|
|
15
|
+
Return tests whose unique coverage falls below *min_unique_lines*.
|
|
16
|
+
|
|
17
|
+
A test is considered "dead" if every line it touches is already covered
|
|
18
|
+
by at least one other test.
|
|
19
|
+
"""
|
|
20
|
+
all_node_ids = [t.node_id for t in tests]
|
|
21
|
+
findings: list[DeadTestFinding] = []
|
|
22
|
+
|
|
23
|
+
for test in tests:
|
|
24
|
+
total_lines = 0
|
|
25
|
+
unique_lines = 0
|
|
26
|
+
|
|
27
|
+
for fc in cov_map.files.values():
|
|
28
|
+
covered = fc.lines_covered_by(test.node_id)
|
|
29
|
+
unique = fc.unique_lines_for(test.node_id, all_node_ids)
|
|
30
|
+
total_lines += len(covered)
|
|
31
|
+
unique_lines += len(unique)
|
|
32
|
+
|
|
33
|
+
if total_lines > 0 and unique_lines < min_unique_lines:
|
|
34
|
+
findings.append(
|
|
35
|
+
DeadTestFinding(
|
|
36
|
+
node_id=test.node_id,
|
|
37
|
+
file=test.file,
|
|
38
|
+
unique_lines=unique_lines,
|
|
39
|
+
total_lines=total_lines,
|
|
40
|
+
reason="no unique coverage",
|
|
41
|
+
)
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
return findings
|