bite-check 1.0.2__tar.gz → 1.0.3__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.
- {bite_check-1.0.2 → bite_check-1.0.3}/PKG-INFO +19 -12
- {bite_check-1.0.2 → bite_check-1.0.3}/README.md +18 -11
- {bite_check-1.0.2 → bite_check-1.0.3}/bite_check.egg-info/PKG-INFO +19 -12
- {bite_check-1.0.2 → bite_check-1.0.3}/bite_check.egg-info/SOURCES.txt +2 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/bite_check.egg-info/top_level.txt +1 -0
- bite_check-1.0.3/bite_check.py +17 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/pyproject.toml +2 -2
- {bite_check-1.0.2 → bite_check-1.0.3}/recent.py +111 -18
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_progress.py +54 -3
- bite_check-1.0.3/tests/test_run_from_anywhere.py +85 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/LICENSE +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/ask.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/bite.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/bite_check.egg-info/dependency_links.txt +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/bite_check.egg-info/entry_points.txt +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/bite_check.egg-info/requires.txt +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/bite_mcp.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/live.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/repo.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/setup.cfg +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_action.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_any_encoding.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_ask.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_bite_claim.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_bot.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_claim_command.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_comeback.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_comment_size.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_copy_names.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_deleted_files.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_doctests.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_fail_comment.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_first_run.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_go_other_systems.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_hang.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_huge_files.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_java_kotlin.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_jobs_memory.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_json.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_later_test_near_tidy.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_live.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_mcp.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_merge_shards.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_most_wanted.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_names.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_no_pings.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_node_copies.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_odd_inputs.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_odd_repos.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_open_pr.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_passing_names.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_paste_paths.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_pr_checklist.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_publish_badge.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_rust_doc_examples.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_rust_unit_tests.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_score.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_score_trend.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_self_check.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_selftest.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_settings_file.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_shallow.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_shard.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_submodules.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_tricks.py +0 -0
- {bite_check-1.0.2 → bite_check-1.0.3}/tests/test_update.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bite-check
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Checks whether the "fixed" in your coding agent's recent commits is actually true.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/connabyss/bite
|
|
@@ -39,16 +39,21 @@ Bite checks whether an AI coding agent's "fixed" is actually true.
|
|
|
39
39
|
|
|
40
40
|
<img alt="bite --demo: one fix is noticed by a test, the other has no test at all" src="https://raw.githubusercontent.com/connabyss/bite/main/assets/bite-demo.svg" width="760">
|
|
41
41
|
|
|
42
|
-
**Try it
|
|
42
|
+
**Try it now.** It's free, needs no key, and never changes your files. If you have Python, paste these two
|
|
43
|
+
lines into any terminal window (PowerShell, cmd, Terminal):
|
|
43
44
|
|
|
44
45
|
```
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
python -m pip install bite-check
|
|
47
|
+
python -m bite_check --free
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Outside a project, Bite first shows a demo on a tiny made-up one. To check your own project, type the second line
|
|
51
|
+
and a space, drag your project's folder into the window (that types its path), and press Enter.
|
|
52
|
+
|
|
53
|
+
Have [pipx](https://pipx.pypa.io) or [uv](https://docs.astral.sh/uv/)? One line does it, no install:
|
|
54
|
+
`pipx run bite-check --free` or `uvx bite-check --free`. (On Linux or a Mac, if pip says "externally managed",
|
|
55
|
+
use one of those.) If your commits never say "fix", add `--any` to check every recent change. To keep Bite
|
|
56
|
+
installed as a `bite` command, see [Try it in a minute](#try-it-in-a-minute).
|
|
52
57
|
|
|
53
58
|
**Here for Hack Week or your first open-source PR?** These [good first issues](https://github.com/connabyss/bite/labels/good%20first%20issue)
|
|
54
59
|
are small, and each one says where to look and when it's done. Comment on one to claim it.
|
|
@@ -117,10 +122,12 @@ out and runs the tests, and you see the difference:
|
|
|
117
122
|
It needs nothing besides git, takes a few seconds, and doesn't touch your files. Then try it on your own project:
|
|
118
123
|
|
|
119
124
|
```
|
|
120
|
-
|
|
121
|
-
bite --free
|
|
125
|
+
bite --free /path/to/your-repo
|
|
122
126
|
```
|
|
123
127
|
|
|
128
|
+
(Or type `bite --free ` and drag the project's folder into the window. From inside the project's folder, plain
|
|
129
|
+
`bite --free` works too.)
|
|
130
|
+
|
|
124
131
|
`bite` now works in any terminal window. `bite --free` needs no key and costs nothing. It takes each recent
|
|
125
132
|
change back out, runs your tests, and lists the changes no test guards, plus any new test that still passes
|
|
126
133
|
without its commit's code (it tests nothing). If something it needs is missing, like git or pytest, it says
|
|
@@ -298,7 +305,7 @@ jobs:
|
|
|
298
305
|
# install what your tests need here, e.g. for Python:
|
|
299
306
|
- uses: actions/setup-python@v7
|
|
300
307
|
- run: python -m pip install pytest -r requirements.txt
|
|
301
|
-
- uses: connabyss/bite@v1.0.
|
|
308
|
+
- uses: connabyss/bite@v1.0.3
|
|
302
309
|
```
|
|
303
310
|
|
|
304
311
|
Options go under `with:`: `args` (extra `bite` options, e.g. `--serious`), `max-commits` (default 20),
|
|
@@ -312,7 +319,7 @@ When no test noticed a change, Bite can write that test for you. Add your Anthro
|
|
|
312
319
|
named `ANTHROPIC_API_KEY`, then:
|
|
313
320
|
|
|
314
321
|
```yaml
|
|
315
|
-
- uses: connabyss/bite@v1.0.
|
|
322
|
+
- uses: connabyss/bite@v1.0.3
|
|
316
323
|
with:
|
|
317
324
|
write-tests: true
|
|
318
325
|
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
@@ -429,7 +436,7 @@ jobs:
|
|
|
429
436
|
with:
|
|
430
437
|
fetch-depth: 0
|
|
431
438
|
# install what your tests need here, as in the pull request check
|
|
432
|
-
- uses: connabyss/bite@v1.0.
|
|
439
|
+
- uses: connabyss/bite@v1.0.3
|
|
433
440
|
with:
|
|
434
441
|
badge-branch: bite-badge
|
|
435
442
|
max-commits: 10
|
|
@@ -13,16 +13,21 @@ Bite checks whether an AI coding agent's "fixed" is actually true.
|
|
|
13
13
|
|
|
14
14
|
<img alt="bite --demo: one fix is noticed by a test, the other has no test at all" src="https://raw.githubusercontent.com/connabyss/bite/main/assets/bite-demo.svg" width="760">
|
|
15
15
|
|
|
16
|
-
**Try it
|
|
16
|
+
**Try it now.** It's free, needs no key, and never changes your files. If you have Python, paste these two
|
|
17
|
+
lines into any terminal window (PowerShell, cmd, Terminal):
|
|
17
18
|
|
|
18
19
|
```
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
python -m pip install bite-check
|
|
21
|
+
python -m bite_check --free
|
|
21
22
|
```
|
|
22
23
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
Outside a project, Bite first shows a demo on a tiny made-up one. To check your own project, type the second line
|
|
25
|
+
and a space, drag your project's folder into the window (that types its path), and press Enter.
|
|
26
|
+
|
|
27
|
+
Have [pipx](https://pipx.pypa.io) or [uv](https://docs.astral.sh/uv/)? One line does it, no install:
|
|
28
|
+
`pipx run bite-check --free` or `uvx bite-check --free`. (On Linux or a Mac, if pip says "externally managed",
|
|
29
|
+
use one of those.) If your commits never say "fix", add `--any` to check every recent change. To keep Bite
|
|
30
|
+
installed as a `bite` command, see [Try it in a minute](#try-it-in-a-minute).
|
|
26
31
|
|
|
27
32
|
**Here for Hack Week or your first open-source PR?** These [good first issues](https://github.com/connabyss/bite/labels/good%20first%20issue)
|
|
28
33
|
are small, and each one says where to look and when it's done. Comment on one to claim it.
|
|
@@ -91,10 +96,12 @@ out and runs the tests, and you see the difference:
|
|
|
91
96
|
It needs nothing besides git, takes a few seconds, and doesn't touch your files. Then try it on your own project:
|
|
92
97
|
|
|
93
98
|
```
|
|
94
|
-
|
|
95
|
-
bite --free
|
|
99
|
+
bite --free /path/to/your-repo
|
|
96
100
|
```
|
|
97
101
|
|
|
102
|
+
(Or type `bite --free ` and drag the project's folder into the window. From inside the project's folder, plain
|
|
103
|
+
`bite --free` works too.)
|
|
104
|
+
|
|
98
105
|
`bite` now works in any terminal window. `bite --free` needs no key and costs nothing. It takes each recent
|
|
99
106
|
change back out, runs your tests, and lists the changes no test guards, plus any new test that still passes
|
|
100
107
|
without its commit's code (it tests nothing). If something it needs is missing, like git or pytest, it says
|
|
@@ -272,7 +279,7 @@ jobs:
|
|
|
272
279
|
# install what your tests need here, e.g. for Python:
|
|
273
280
|
- uses: actions/setup-python@v7
|
|
274
281
|
- run: python -m pip install pytest -r requirements.txt
|
|
275
|
-
- uses: connabyss/bite@v1.0.
|
|
282
|
+
- uses: connabyss/bite@v1.0.3
|
|
276
283
|
```
|
|
277
284
|
|
|
278
285
|
Options go under `with:`: `args` (extra `bite` options, e.g. `--serious`), `max-commits` (default 20),
|
|
@@ -286,7 +293,7 @@ When no test noticed a change, Bite can write that test for you. Add your Anthro
|
|
|
286
293
|
named `ANTHROPIC_API_KEY`, then:
|
|
287
294
|
|
|
288
295
|
```yaml
|
|
289
|
-
- uses: connabyss/bite@v1.0.
|
|
296
|
+
- uses: connabyss/bite@v1.0.3
|
|
290
297
|
with:
|
|
291
298
|
write-tests: true
|
|
292
299
|
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
@@ -403,7 +410,7 @@ jobs:
|
|
|
403
410
|
with:
|
|
404
411
|
fetch-depth: 0
|
|
405
412
|
# install what your tests need here, as in the pull request check
|
|
406
|
-
- uses: connabyss/bite@v1.0.
|
|
413
|
+
- uses: connabyss/bite@v1.0.3
|
|
407
414
|
with:
|
|
408
415
|
badge-branch: bite-badge
|
|
409
416
|
max-commits: 10
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: bite-check
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
4
4
|
Summary: Checks whether the "fixed" in your coding agent's recent commits is actually true.
|
|
5
5
|
License-Expression: MIT
|
|
6
6
|
Project-URL: Homepage, https://github.com/connabyss/bite
|
|
@@ -39,16 +39,21 @@ Bite checks whether an AI coding agent's "fixed" is actually true.
|
|
|
39
39
|
|
|
40
40
|
<img alt="bite --demo: one fix is noticed by a test, the other has no test at all" src="https://raw.githubusercontent.com/connabyss/bite/main/assets/bite-demo.svg" width="760">
|
|
41
41
|
|
|
42
|
-
**Try it
|
|
42
|
+
**Try it now.** It's free, needs no key, and never changes your files. If you have Python, paste these two
|
|
43
|
+
lines into any terminal window (PowerShell, cmd, Terminal):
|
|
43
44
|
|
|
44
45
|
```
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
python -m pip install bite-check
|
|
47
|
+
python -m bite_check --free
|
|
47
48
|
```
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
Outside a project, Bite first shows a demo on a tiny made-up one. To check your own project, type the second line
|
|
51
|
+
and a space, drag your project's folder into the window (that types its path), and press Enter.
|
|
52
|
+
|
|
53
|
+
Have [pipx](https://pipx.pypa.io) or [uv](https://docs.astral.sh/uv/)? One line does it, no install:
|
|
54
|
+
`pipx run bite-check --free` or `uvx bite-check --free`. (On Linux or a Mac, if pip says "externally managed",
|
|
55
|
+
use one of those.) If your commits never say "fix", add `--any` to check every recent change. To keep Bite
|
|
56
|
+
installed as a `bite` command, see [Try it in a minute](#try-it-in-a-minute).
|
|
52
57
|
|
|
53
58
|
**Here for Hack Week or your first open-source PR?** These [good first issues](https://github.com/connabyss/bite/labels/good%20first%20issue)
|
|
54
59
|
are small, and each one says where to look and when it's done. Comment on one to claim it.
|
|
@@ -117,10 +122,12 @@ out and runs the tests, and you see the difference:
|
|
|
117
122
|
It needs nothing besides git, takes a few seconds, and doesn't touch your files. Then try it on your own project:
|
|
118
123
|
|
|
119
124
|
```
|
|
120
|
-
|
|
121
|
-
bite --free
|
|
125
|
+
bite --free /path/to/your-repo
|
|
122
126
|
```
|
|
123
127
|
|
|
128
|
+
(Or type `bite --free ` and drag the project's folder into the window. From inside the project's folder, plain
|
|
129
|
+
`bite --free` works too.)
|
|
130
|
+
|
|
124
131
|
`bite` now works in any terminal window. `bite --free` needs no key and costs nothing. It takes each recent
|
|
125
132
|
change back out, runs your tests, and lists the changes no test guards, plus any new test that still passes
|
|
126
133
|
without its commit's code (it tests nothing). If something it needs is missing, like git or pytest, it says
|
|
@@ -298,7 +305,7 @@ jobs:
|
|
|
298
305
|
# install what your tests need here, e.g. for Python:
|
|
299
306
|
- uses: actions/setup-python@v7
|
|
300
307
|
- run: python -m pip install pytest -r requirements.txt
|
|
301
|
-
- uses: connabyss/bite@v1.0.
|
|
308
|
+
- uses: connabyss/bite@v1.0.3
|
|
302
309
|
```
|
|
303
310
|
|
|
304
311
|
Options go under `with:`: `args` (extra `bite` options, e.g. `--serious`), `max-commits` (default 20),
|
|
@@ -312,7 +319,7 @@ When no test noticed a change, Bite can write that test for you. Add your Anthro
|
|
|
312
319
|
named `ANTHROPIC_API_KEY`, then:
|
|
313
320
|
|
|
314
321
|
```yaml
|
|
315
|
-
- uses: connabyss/bite@v1.0.
|
|
322
|
+
- uses: connabyss/bite@v1.0.3
|
|
316
323
|
with:
|
|
317
324
|
write-tests: true
|
|
318
325
|
anthropic-api-key: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
@@ -429,7 +436,7 @@ jobs:
|
|
|
429
436
|
with:
|
|
430
437
|
fetch-depth: 0
|
|
431
438
|
# install what your tests need here, as in the pull request check
|
|
432
|
-
- uses: connabyss/bite@v1.0.
|
|
439
|
+
- uses: connabyss/bite@v1.0.3
|
|
433
440
|
with:
|
|
434
441
|
badge-branch: bite-badge
|
|
435
442
|
max-commits: 10
|
|
@@ -2,6 +2,7 @@ LICENSE
|
|
|
2
2
|
README.md
|
|
3
3
|
ask.py
|
|
4
4
|
bite.py
|
|
5
|
+
bite_check.py
|
|
5
6
|
bite_mcp.py
|
|
6
7
|
live.py
|
|
7
8
|
pyproject.toml
|
|
@@ -48,6 +49,7 @@ tests/test_paste_paths.py
|
|
|
48
49
|
tests/test_pr_checklist.py
|
|
49
50
|
tests/test_progress.py
|
|
50
51
|
tests/test_publish_badge.py
|
|
52
|
+
tests/test_run_from_anywhere.py
|
|
51
53
|
tests/test_rust_doc_examples.py
|
|
52
54
|
tests/test_rust_unit_tests.py
|
|
53
55
|
tests/test_score.py
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"""`python -m bite_check`: runs Bite with only Python and pip, when the `bite` command isn't on PATH (a common
|
|
2
|
+
case on Windows, where pip puts commands in a folder PATH doesn't list)."""
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
if __name__ == "__main__":
|
|
8
|
+
# python -m puts the current folder first on sys.path. Inside someone's project, their own recent.py (a common
|
|
9
|
+
# name) would then be imported instead of Bite's, so leave it out unless Bite itself lives here (a clone).
|
|
10
|
+
here = os.path.dirname(os.path.abspath(__file__))
|
|
11
|
+
cwd = os.getcwd()
|
|
12
|
+
if os.path.normcase(here) != os.path.normcase(cwd):
|
|
13
|
+
sys.path[:] = [p for p in sys.path
|
|
14
|
+
if p not in ("", ".") and os.path.normcase(os.path.abspath(p)) != os.path.normcase(cwd)]
|
|
15
|
+
from recent import main
|
|
16
|
+
|
|
17
|
+
sys.exit(main())
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "bite-check"
|
|
7
|
-
version = "1.0.
|
|
7
|
+
version = "1.0.3"
|
|
8
8
|
description = "Checks whether the \"fixed\" in your coding agent's recent commits is actually true."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
@@ -35,7 +35,7 @@ Source = "https://github.com/connabyss/bite"
|
|
|
35
35
|
Issues = "https://github.com/connabyss/bite/issues"
|
|
36
36
|
|
|
37
37
|
[tool.setuptools]
|
|
38
|
-
py-modules = ["ask", "bite", "bite_mcp", "live", "recent", "repo"]
|
|
38
|
+
py-modules = ["ask", "bite", "bite_check", "bite_mcp", "live", "recent", "repo"]
|
|
39
39
|
|
|
40
40
|
[tool.pytest.ini_options]
|
|
41
41
|
testpaths = ["tests"]
|
|
@@ -4,7 +4,10 @@ Bite: did your coding agent's recent "done" commits really do what they said?
|
|
|
4
4
|
bite check the last 40 commits (step 2 needs an API key)
|
|
5
5
|
bite --version print the installed version, and the line to update when a newer one is out
|
|
6
6
|
bite --free step 1 only: no key, no cost
|
|
7
|
-
bite --demo try it on a tiny made-up project first (free, about 30 seconds)
|
|
7
|
+
bite --demo try it on a tiny made-up project first (free, about 30 seconds); run outside a
|
|
8
|
+
project, plain bite does the same
|
|
9
|
+
bite --free path/to/repo check that project without going into its folder first (you can drag the folder
|
|
10
|
+
into the terminal window to type its path)
|
|
8
11
|
bite --demo comeback see the comeback alarm: a later commit quietly undoes a fix, and Bite names it
|
|
9
12
|
bite --last 80 --suspects 3 --budget 1.00
|
|
10
13
|
bite --serious only fix claims about data, money, logins, security, crashes or leaks
|
|
@@ -23,6 +26,8 @@ Bite: did your coding agent's recent "done" commits really do what they said?
|
|
|
23
26
|
fails again with the machine to itself, so tests that share a port can't hide a gap
|
|
24
27
|
(A commit checked before with ✅, with the same tests and settings, isn't run again: bite_proof/checked.json.
|
|
25
28
|
A test deleted since, or a changed test command, makes it run again; --again always does.)
|
|
29
|
+
bite --verbose say what each test run is (change in, change out, the rerun, each piece) instead of
|
|
30
|
+
one line per finished check
|
|
26
31
|
bite --json print the results as JSON for other programs (the rest goes to stderr); they're
|
|
27
32
|
also saved in bite_proof/results.json on every run
|
|
28
33
|
bite --write-tests after the free check, write the missing test for each change no test noticed
|
|
@@ -948,6 +953,54 @@ _BUSY = [0, False] # test runs going on side by side, and whether one has the m
|
|
|
948
953
|
_SHARED = {} # each test run going on now: whether another ran beside it at any point
|
|
949
954
|
|
|
950
955
|
|
|
956
|
+
TICK = 30 # seconds between "still running" lines while test runs go on
|
|
957
|
+
_ACTIVE = {} # each test run going on now: when it started
|
|
958
|
+
_TICKER = [None] # the one thread printing those lines, while any run is going on
|
|
959
|
+
PROGRESS = {"start": 0.0, "done": 0, "total": 0} # the free check as a whole, for those lines
|
|
960
|
+
VERBOSE = [False] # --verbose: a line before every test run (change in, change out, reruns, pieces)
|
|
961
|
+
|
|
962
|
+
|
|
963
|
+
def _ticker():
|
|
964
|
+
"""Every TICK seconds, one line for all the test runs going on (one per commit with --jobs), so a slow suite
|
|
965
|
+
doesn't look stuck. Ends when none is left."""
|
|
966
|
+
while True:
|
|
967
|
+
with _GATE:
|
|
968
|
+
if _GATE.wait_for(lambda: not _ACTIVE, timeout=TICK): # the last run ended: stop now, not a tick later
|
|
969
|
+
_TICKER[0] = None
|
|
970
|
+
return
|
|
971
|
+
now = time.monotonic()
|
|
972
|
+
if PROGRESS["total"]:
|
|
973
|
+
line = (f"still checking: {PROGRESS['done']} of {PROGRESS['total']} done, "
|
|
974
|
+
f"{spelled(now - PROGRESS['start'])} so far...")
|
|
975
|
+
else:
|
|
976
|
+
line = f"still running the tests, {spelled(now - min(_ACTIVE.values()))} so far..."
|
|
977
|
+
print(f" {line}", flush=True)
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
def spelled(secs: float) -> str:
|
|
981
|
+
"""A time in words a newcomer reads at a glance: "45 sec", "2 min", "3 min 30 sec" (not "3m 30s")."""
|
|
982
|
+
secs = round(secs)
|
|
983
|
+
if secs < 60:
|
|
984
|
+
return f"{secs} sec"
|
|
985
|
+
return f"{secs // 60} min" + (f" {secs % 60} sec" if secs % 60 else "")
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
def _timed(fcfg, folder) -> dict:
|
|
989
|
+
"""bite.run_tests, counted in the "still running" lines while it goes on."""
|
|
990
|
+
me = object()
|
|
991
|
+
with _GATE:
|
|
992
|
+
_ACTIVE[me] = time.monotonic()
|
|
993
|
+
if _TICKER[0] is None:
|
|
994
|
+
_TICKER[0] = threading.Thread(target=_ticker, daemon=True)
|
|
995
|
+
_TICKER[0].start()
|
|
996
|
+
try:
|
|
997
|
+
return bite.run_tests(fcfg, folder)
|
|
998
|
+
finally:
|
|
999
|
+
with _GATE:
|
|
1000
|
+
del _ACTIVE[me]
|
|
1001
|
+
_GATE.notify_all()
|
|
1002
|
+
|
|
1003
|
+
|
|
951
1004
|
def run_tests(fcfg, folder, alone: bool = False, confirm: bool = True) -> dict:
|
|
952
1005
|
"""bite.run_tests, and with --jobs, side by side with other commits' runs. Tests run side by side can trip over
|
|
953
1006
|
each other (the same port, the same database), and a failure caused by that would read as "a test noticed" and
|
|
@@ -957,7 +1010,7 @@ def run_tests(fcfg, folder, alone: bool = False, confirm: bool = True) -> dict:
|
|
|
957
1010
|
alone: run it with the machine to itself straight away. confirm=False: return a failed shared run as it is
|
|
958
1011
|
(marked "shared"), for a caller whose next run (alone) confirms it anyway."""
|
|
959
1012
|
if JOBS[0] <= 1:
|
|
960
|
-
return
|
|
1013
|
+
return _timed(fcfg, folder)
|
|
961
1014
|
if alone:
|
|
962
1015
|
return _run_alone(fcfg, folder)
|
|
963
1016
|
me = object()
|
|
@@ -968,7 +1021,7 @@ def run_tests(fcfg, folder, alone: bool = False, confirm: bool = True) -> dict:
|
|
|
968
1021
|
for other in _SHARED: # every run going on now shares the machine with this one
|
|
969
1022
|
_SHARED[other] = _SHARED[other] or _SHARED[me]
|
|
970
1023
|
try:
|
|
971
|
-
r =
|
|
1024
|
+
r = _timed(fcfg, folder)
|
|
972
1025
|
finally:
|
|
973
1026
|
with _GATE:
|
|
974
1027
|
_BUSY[0] -= 1
|
|
@@ -986,7 +1039,7 @@ def _run_alone(fcfg, folder) -> dict:
|
|
|
986
1039
|
_GATE.wait_for(lambda: not _BUSY[1] and not _BUSY[0])
|
|
987
1040
|
_BUSY[1] = True
|
|
988
1041
|
try:
|
|
989
|
-
return
|
|
1042
|
+
return _timed(fcfg, folder)
|
|
990
1043
|
finally:
|
|
991
1044
|
with _GATE:
|
|
992
1045
|
_BUSY[1] = False
|
|
@@ -1038,8 +1091,10 @@ def remember(root: Path, memo: dict) -> None:
|
|
|
1038
1091
|
|
|
1039
1092
|
|
|
1040
1093
|
def doing(c: dict, text: str) -> None:
|
|
1041
|
-
"""
|
|
1042
|
-
|
|
1094
|
+
"""With --verbose, one line before each test run saying what it is. Without it the log stays calm: one line per
|
|
1095
|
+
finished check, and a "still checking" line every TICK seconds."""
|
|
1096
|
+
if VERBOSE[0]:
|
|
1097
|
+
print(f" {c['sha'][:8]} {text}", flush=True)
|
|
1043
1098
|
|
|
1044
1099
|
|
|
1045
1100
|
def undo_check(root: Path, c: dict, cfg) -> str:
|
|
@@ -1095,7 +1150,7 @@ def check_undo(root: Path, c: dict, cfg) -> str:
|
|
|
1095
1150
|
if not crashed and not QUICK[0]:
|
|
1096
1151
|
# Once more: a test that fails now and then (flaky) can fail by luck. Only a test that fails every
|
|
1097
1152
|
# time the change is out counts as noticing it.
|
|
1098
|
-
doing(c, "a test
|
|
1153
|
+
doing(c, "good sign, a test noticed the change was gone: running them once more to make sure it wasn't luck"
|
|
1099
1154
|
+ (" (alone, so the other check running beside it can't be the cause)..." if undone.get("shared") else "..."))
|
|
1100
1155
|
again = run_tests(fcfg, folder, alone=bool(undone.get("shared")))
|
|
1101
1156
|
if again["ok"]:
|
|
@@ -1298,8 +1353,7 @@ def caught_by(out: str) -> str:
|
|
|
1298
1353
|
|
|
1299
1354
|
|
|
1300
1355
|
def took(run: dict) -> str:
|
|
1301
|
-
|
|
1302
|
-
return f"{secs // 60}m {secs % 60}s" if secs >= 60 else f"{secs}s"
|
|
1356
|
+
return spelled(run.get("secs") or 0)
|
|
1303
1357
|
|
|
1304
1358
|
|
|
1305
1359
|
def hang_note(undone: dict, now: dict) -> str:
|
|
@@ -2516,12 +2570,30 @@ def demo(argv: list) -> int:
|
|
|
2516
2570
|
rc = main(["--free", *(a for a in argv if a not in ("--demo", "--free", "comeback"))])
|
|
2517
2571
|
finally:
|
|
2518
2572
|
os.chdir(here)
|
|
2519
|
-
print("\nThat was the demo; nothing of yours was touched
|
|
2573
|
+
print("\nThat was the demo; nothing of yours was touched.\n"
|
|
2574
|
+
f"To check your own project: type {how_called()} --free and a space, drag your project's folder into this\n"
|
|
2575
|
+
"window (that types its path for you), then press Enter.")
|
|
2520
2576
|
return rc
|
|
2521
2577
|
|
|
2522
2578
|
|
|
2579
|
+
def how_called() -> str:
|
|
2580
|
+
"""The command this run was started with, as a person would type it again: bite, bite-check, pipx run bite-check,
|
|
2581
|
+
uvx bite-check, python -m bite_check or python recent.py."""
|
|
2582
|
+
exe, name = sys.executable.replace("\\", "/").lower(), Path(sys.argv[0] if sys.argv else "bite").name.lower()
|
|
2583
|
+
if name in ("bite_check.py", "__main__.py"):
|
|
2584
|
+
return "python -m bite_check"
|
|
2585
|
+
if name.endswith(".py"):
|
|
2586
|
+
return f"python {name}"
|
|
2587
|
+
if "/pipx/" in exe and "/.cache/" in exe: # pipx run keeps its throwaway environments in pipx's .cache
|
|
2588
|
+
return "pipx run bite-check"
|
|
2589
|
+
if "/uv/" in exe and ("/archive-v" in exe or "/cache/" in exe): # uvx: uv's cache
|
|
2590
|
+
return "uvx bite-check"
|
|
2591
|
+
return "bite-check" if name.startswith("bite-check") else "bite"
|
|
2592
|
+
|
|
2593
|
+
|
|
2523
2594
|
# Every option main() accepts; each one must be in the help text above (the self-test checks).
|
|
2524
|
-
|
|
2595
|
+
JSON_RUN = [False] # set while --json runs, so a run outside a repo answers with JSON instead of the demo
|
|
2596
|
+
FLAGS = {"--verbose", "--free", "--all", "--any", "--serious", "--again", "--roast", "--demo", "--write-tests", "--json", "--quick"}
|
|
2525
2597
|
VALUED = {"--last": int, "--free-checks": int, "--suspects": int, "--budget": float, "--since": str, "--part-runs": int,
|
|
2526
2598
|
"--shard": str, "--only": str, "--jobs": int}
|
|
2527
2599
|
VALUE_EXAMPLE = {"--budget": "1.00", "--since": "main", "--part-runs": 6, "--shard": "2/5", "--only": "1a2b3c4d", "--jobs": 4}
|
|
@@ -2607,8 +2679,12 @@ def main(argv=None):
|
|
|
2607
2679
|
import contextlib
|
|
2608
2680
|
out, argv = sys.stdout, [a for a in argv if a != "--json"]
|
|
2609
2681
|
LAST_RESULTS[0] = None
|
|
2610
|
-
|
|
2611
|
-
|
|
2682
|
+
JSON_RUN[0] = True
|
|
2683
|
+
try:
|
|
2684
|
+
with contextlib.redirect_stdout(sys.stderr):
|
|
2685
|
+
rc = main(argv)
|
|
2686
|
+
finally:
|
|
2687
|
+
JSON_RUN[0] = False
|
|
2612
2688
|
if LAST_RESULTS[0]:
|
|
2613
2689
|
out.write(LAST_RESULTS[0].read_text(encoding="utf-8"))
|
|
2614
2690
|
else:
|
|
@@ -2636,7 +2712,7 @@ def main(argv=None):
|
|
|
2636
2712
|
if "-h" in argv or "--help" in argv:
|
|
2637
2713
|
print(__doc__.strip())
|
|
2638
2714
|
return 0
|
|
2639
|
-
i = 0
|
|
2715
|
+
i, folder = 0, None
|
|
2640
2716
|
while i < len(argv): # a typo must not fall through to the paid step
|
|
2641
2717
|
if argv[i] in VALUED and i + 1 >= len(argv):
|
|
2642
2718
|
print(f"Bite: {argv[i]} needs a value after it, like {argv[i]} {VALUE_EXAMPLE.get(argv[i], 10)}.")
|
|
@@ -2655,12 +2731,16 @@ def main(argv=None):
|
|
|
2655
2731
|
i += 2
|
|
2656
2732
|
elif argv[i] in FLAGS or (argv[i] == "comeback" and i and argv[i - 1] == "--demo"):
|
|
2657
2733
|
i += 1
|
|
2734
|
+
elif folder is None and not argv[i].startswith("-") and Path(argv[i].strip("\"'")).is_dir():
|
|
2735
|
+
# The project's folder, so nobody has to cd first: dragging a folder into the window types its path.
|
|
2736
|
+
folder = argv.pop(i).strip("\"'")
|
|
2658
2737
|
else:
|
|
2659
2738
|
print(f"Bite: unknown option {argv[i]!r}. Run bite --help for the options.")
|
|
2660
2739
|
return 2
|
|
2661
2740
|
opt = lambda k, d: type(d)(argv[argv.index(k) + 1]) if k in argv else d # noqa: E731
|
|
2662
2741
|
ROAST[0] = "--roast" in argv
|
|
2663
2742
|
QUICK[0] = "--quick" in argv
|
|
2743
|
+
VERBOSE[0] = "--verbose" in argv
|
|
2664
2744
|
PART_RUNS[0] = opt("--part-runs", 6)
|
|
2665
2745
|
JOBS[0] = max(1, opt("--jobs", 1))
|
|
2666
2746
|
shard = re.fullmatch(r"(\d+)/(\d+)", opt("--shard", "1/1"))
|
|
@@ -2674,10 +2754,20 @@ def main(argv=None):
|
|
|
2674
2754
|
return 1
|
|
2675
2755
|
if "--demo" in argv:
|
|
2676
2756
|
return demo(argv)
|
|
2677
|
-
root = repo.repo_root(os.getcwd())
|
|
2757
|
+
root = repo.repo_root(folder or os.getcwd())
|
|
2678
2758
|
if root is None:
|
|
2679
|
-
|
|
2680
|
-
|
|
2759
|
+
if folder:
|
|
2760
|
+
print(f"Bite: {folder} isn't a project with git history (not inside a git repository), so there's\n"
|
|
2761
|
+
"nothing to check there. Pick the folder you cloned or made with git, the one with your code in it.")
|
|
2762
|
+
return 1
|
|
2763
|
+
if JSON_RUN[0]:
|
|
2764
|
+
print("Bite: not inside a git repository.")
|
|
2765
|
+
return 1
|
|
2766
|
+
# A first run from wherever the terminal opened (C:\WINDOWS\system32, the home folder): show what Bite
|
|
2767
|
+
# does on a made-up project instead of stopping, and say how to point it at a real one.
|
|
2768
|
+
print(f"Bite: this folder ({os.getcwd()}) isn't a project with git history (not inside a git repository),\n"
|
|
2769
|
+
"so here's Bite's demo on a tiny made-up project instead.\n", flush=True)
|
|
2770
|
+
return demo(["--demo"])
|
|
2681
2771
|
try:
|
|
2682
2772
|
cfg = repo.load_cfg(root)
|
|
2683
2773
|
except repo.ConfigError as e:
|
|
@@ -2794,6 +2884,7 @@ def main(argv=None):
|
|
|
2794
2884
|
"(--again runs them anyway)", flush=True)
|
|
2795
2885
|
|
|
2796
2886
|
def done(c):
|
|
2887
|
+
PROGRESS["done"] += 1
|
|
2797
2888
|
if c["undo"].startswith("unguarded"):
|
|
2798
2889
|
c["score"] += 2
|
|
2799
2890
|
elif c["undo"] == "TEST GUARDS NOTHING":
|
|
@@ -2805,6 +2896,7 @@ def main(argv=None):
|
|
|
2805
2896
|
memo[c["sha"]] = {"key": key, "undo": c["undo"], "caught": c.get("caught", "")}
|
|
2806
2897
|
remember(root, memo)
|
|
2807
2898
|
save_log(root, kept, cs)
|
|
2899
|
+
PROGRESS.update(start=time.monotonic(), done=0, total=len(free))
|
|
2808
2900
|
for c in free:
|
|
2809
2901
|
if c.get("remembered"):
|
|
2810
2902
|
done(c)
|
|
@@ -2821,6 +2913,7 @@ def main(argv=None):
|
|
|
2821
2913
|
for c in todo:
|
|
2822
2914
|
c["undo"] = undo_check(root, c, cfg)
|
|
2823
2915
|
done(c)
|
|
2916
|
+
PROGRESS["total"] = 0
|
|
2824
2917
|
tip = slow_tip((time.time() - t_free) / len(todo), len(todo), cfg) if todo else ""
|
|
2825
2918
|
if tip:
|
|
2826
2919
|
print(f" {tip}", flush=True)
|
|
@@ -2918,7 +3011,7 @@ def main(argv=None):
|
|
|
2918
3011
|
f"Badge for your README: {BADGE}")
|
|
2919
3012
|
if flagged:
|
|
2920
3013
|
print(f"Each change no test noticed, with a check you can rerun and a note for your coding AI: {write_free(root, cfg, flagged)}")
|
|
2921
|
-
print(f"\
|
|
3014
|
+
print(f"\nTook {spelled(time.time() - t0)}, spent ${SPENT[0]:.2f}.")
|
|
2922
3015
|
save_log(root, tried, cs)
|
|
2923
3016
|
save_missing_tests(root, flagged)
|
|
2924
3017
|
write_comment(root, cs, newest=newest, tried=tried)
|
|
@@ -73,9 +73,60 @@ def test_the_log_says_what_each_test_run_is():
|
|
|
73
73
|
(root / name).write_text(text, encoding="utf-8", newline="\n")
|
|
74
74
|
subprocess.run([*GIT, "add", "-A"], cwd=root, check=True)
|
|
75
75
|
subprocess.run([*GIT, "commit", "-q", "-m", subject], cwd=root, check=True)
|
|
76
|
-
p = subprocess.run([sys.executable, RECENT, "--free", "--any"], cwd=root, capture_output=True,
|
|
77
|
-
encoding="utf-8", env={**os.environ, "PYTHONIOENCODING": "utf-8"})
|
|
76
|
+
p = subprocess.run([sys.executable, RECENT, "--free", "--any", "--verbose"], cwd=root, capture_output=True,
|
|
77
|
+
text=True, encoding="utf-8", env={**os.environ, "PYTHONIOENCODING": "utf-8"})
|
|
78
78
|
log = p.stdout + p.stderr
|
|
79
79
|
assert "running the tests with the change in..." in log, log
|
|
80
80
|
assert "with the change taken out" in log, log
|
|
81
|
-
assert "once more
|
|
81
|
+
assert "a test noticed the change was gone: running them once more to make sure it wasn't luck" in log, log
|
|
82
|
+
# Without --verbose the log is calm (CH, 2026-11-02: "confusing and messy"): no line per test run, only the
|
|
83
|
+
# result of each check.
|
|
84
|
+
calm = subprocess.run([sys.executable, RECENT, "--free", "--any", "--again"], cwd=root, capture_output=True,
|
|
85
|
+
text=True, encoding="utf-8", env={**os.environ, "PYTHONIOENCODING": "utf-8"}).stdout
|
|
86
|
+
assert "Fix total adding one too many" in calm and "noticed by" in calm, calm
|
|
87
|
+
assert "running the tests with the change" not in calm and "once more" not in calm, calm
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def test_a_long_test_run_says_it_is_still_running(monkeypatch, capsys):
|
|
91
|
+
# On CH's PC (2026-11-02) each run of a 34-second suite left the log silent, which looks stuck to a newcomer.
|
|
92
|
+
fake_runs(monkeypatch, secs=0.35)
|
|
93
|
+
monkeypatch.setattr(recent, "JOBS", [1])
|
|
94
|
+
monkeypatch.setattr(recent, "TICK", 0.1)
|
|
95
|
+
recent.doing({"sha": "abcdef1234"}, "running the tests with the change in...")
|
|
96
|
+
recent.run_tests(None, "a")
|
|
97
|
+
out = capsys.readouterr().out
|
|
98
|
+
assert "still running the tests, 0 sec so far..." in out, out # outside the free check (bite live)
|
|
99
|
+
time.sleep(0.3) # and it stops when the run ends
|
|
100
|
+
assert "still running" not in capsys.readouterr().out
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def test_runs_side_by_side_share_one_still_running_line(monkeypatch, capsys):
|
|
104
|
+
# With --jobs 2 each run printed its own line every 30s, interleaved and hard to follow (CH, 2026-11-02).
|
|
105
|
+
both = threading.Barrier(2)
|
|
106
|
+
|
|
107
|
+
def run(fcfg, folder):
|
|
108
|
+
both.wait() # both runs are going on before the first tick (a slow machine starts one late)
|
|
109
|
+
time.sleep(0.6)
|
|
110
|
+
return {"ok": True, "out": "", "why": ""}
|
|
111
|
+
monkeypatch.setattr(recent.bite, "run_tests", run)
|
|
112
|
+
monkeypatch.setattr(recent, "TICK", 0.25)
|
|
113
|
+
monkeypatch.setattr(recent, "PROGRESS", {"start": time.monotonic(), "done": 1, "total": 4})
|
|
114
|
+
ts = [threading.Thread(target=recent._timed, args=(None, n)) for n in ("a", "b")]
|
|
115
|
+
for t in ts:
|
|
116
|
+
t.start()
|
|
117
|
+
for t in ts:
|
|
118
|
+
t.join()
|
|
119
|
+
ticks = [ln.strip() for ln in capsys.readouterr().out.splitlines() if "still" in ln]
|
|
120
|
+
assert ticks and ticks[0].startswith("still checking: 1 of 4 done, "), ticks
|
|
121
|
+
assert len(ticks) <= 3, ticks # one line per tick for both runs, not one per run
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def test_times_are_spelled_out():
|
|
125
|
+
assert recent.spelled(45) == "45 sec" and recent.spelled(210) == "3 min 30 sec" and recent.spelled(120) == "2 min"
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def test_the_log_spells_out_times():
|
|
129
|
+
# CH (2026-11-02): "what is 3m". "They took 1m 25s with it in" and "210s, $0.00" now say it in words.
|
|
130
|
+
assert recent.took({"secs": 85}) == "1 min 25 sec"
|
|
131
|
+
src = Path(RECENT).read_text(encoding="utf-8")
|
|
132
|
+
assert "Took {spelled(time.time() - t0)}, spent $" in src
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""A newcomer opens a terminal and pastes the one line from the README (2026-11-02, on Windows). The terminal opens in
|
|
2
|
+
C:\\WINDOWS\\system32, not in a project, and Bite only said "not inside a git repository": a dead end for someone who
|
|
3
|
+
doesn't know what cd or a git repository is. Now a run outside a project shows the demo and says how to point Bite at
|
|
4
|
+
a project (drag its folder into the window), Bite takes that folder as an argument, and `python -m bite_check` runs
|
|
5
|
+
Bite with nothing but Python and pip, when the `bite` command isn't on PATH. No key, no network."""
|
|
6
|
+
|
|
7
|
+
import os
|
|
8
|
+
import subprocess
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
KIT = Path(__file__).resolve().parent.parent
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def run(cwd, *args, module=False):
|
|
16
|
+
cmd = [sys.executable, "-m", "bite_check", *args] if module else [sys.executable, str(KIT / "recent.py"), *args]
|
|
17
|
+
env = {**os.environ, "PYTHONPATH": str(KIT)} if module else None
|
|
18
|
+
return subprocess.run(cmd, cwd=cwd, capture_output=True, text=True, encoding="utf-8", timeout=300, env=env)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def git(root, *a):
|
|
22
|
+
subprocess.run(["git", *a], cwd=root, check=True, capture_output=True)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def shop(root):
|
|
26
|
+
root.mkdir()
|
|
27
|
+
git(root, "init", "-q")
|
|
28
|
+
(root / "shop.py").write_text("def total(xs):\n return sum(xs)\n")
|
|
29
|
+
(root / "test_shop.py").write_text("import unittest\nfrom shop import total\n\n\nclass T(unittest.TestCase):\n"
|
|
30
|
+
" def test_total(self):\n self.assertEqual(total([1, 2]), 3)\n")
|
|
31
|
+
(root / ".bite.ini").write_text(f'[bite]\ntest_command = "{sys.executable}" -m unittest\n')
|
|
32
|
+
for msg in ("start", "Fix total rounding"):
|
|
33
|
+
if msg != "start":
|
|
34
|
+
(root / "shop.py").write_text("def total(xs):\n return round(sum(xs), 2)\n")
|
|
35
|
+
git(root, "add", "-A")
|
|
36
|
+
git(root, "-c", "user.name=t", "-c", "user.email=t@t", "-c", "commit.gpgsign=false", "commit", "-q", "-m", msg)
|
|
37
|
+
return root
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def test_outside_a_project_shows_the_demo_and_how_to_check_your_own(tmp_path):
|
|
41
|
+
p = run(tmp_path, "--free")
|
|
42
|
+
assert p.returncode == 0, p.stdout + p.stderr
|
|
43
|
+
assert "isn't a project with git history" in p.stdout
|
|
44
|
+
assert "NO TEST NOTICED" in p.stdout and "noticed by test_discount_never_below_zero" in p.stdout
|
|
45
|
+
assert "drag your project's folder into this" in p.stdout
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def test_a_folder_argument_checks_that_project_without_cd(tmp_path):
|
|
49
|
+
root = shop(tmp_path / "my shop") # a space in the name, as a dragged Windows path often has
|
|
50
|
+
p = run(tmp_path, "--free", str(root))
|
|
51
|
+
assert p.returncode == 0, p.stdout + p.stderr
|
|
52
|
+
assert "Fix total rounding" in p.stdout and "demo" not in p.stdout.lower()
|
|
53
|
+
assert (root / "bite_proof" / "report.html").is_file()
|
|
54
|
+
quoted = run(tmp_path, f'"{root}"', "--free") # a drop that keeps its quotes
|
|
55
|
+
assert quoted.returncode == 0 and "Fix total rounding" in quoted.stdout, quoted.stdout
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def test_a_folder_that_isnt_a_project_says_so_plainly(tmp_path):
|
|
59
|
+
(tmp_path / "photos").mkdir()
|
|
60
|
+
p = run(tmp_path, "--free", str(tmp_path / "photos"))
|
|
61
|
+
assert p.returncode == 1 and "isn't a project with git history" in p.stdout and "demo" not in p.stdout.lower()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def test_python_m_bite_check_runs_bite_and_ignores_the_projects_own_same_named_files(tmp_path):
|
|
65
|
+
root = shop(tmp_path / "shop")
|
|
66
|
+
(root / "recent.py").write_text("raise SystemExit('the project\\'s own recent.py was imported')\n")
|
|
67
|
+
p = run(root, "--free", module=True)
|
|
68
|
+
assert p.returncode == 0, p.stdout + p.stderr
|
|
69
|
+
assert "Fix total rounding" in p.stdout
|
|
70
|
+
assert "bite_check" in (KIT / "pyproject.toml").read_text(encoding="utf-8").split("py-modules", 1)[1].split("\n")[0]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def test_how_called_names_the_command_a_person_typed(monkeypatch):
|
|
74
|
+
sys.path.insert(0, str(KIT))
|
|
75
|
+
import recent
|
|
76
|
+
for exe, argv0, want in [
|
|
77
|
+
("C:\\Users\\a\\AppData\\Local\\pipx\\pipx\\.cache\\1f2e\\Scripts\\python.exe", "C:\\x\\Scripts\\bite-check.exe",
|
|
78
|
+
"pipx run bite-check"),
|
|
79
|
+
("C:\\Users\\a\\AppData\\Local\\uv\\cache\\archive-v0\\abc\\Scripts\\python.exe", "bite-check", "uvx bite-check"),
|
|
80
|
+
("/usr/bin/python3", "/home/a/.local/bin/bite", "bite"),
|
|
81
|
+
("/usr/bin/python3", "/site-packages/bite_check.py", "python -m bite_check"),
|
|
82
|
+
]:
|
|
83
|
+
monkeypatch.setattr(sys, "executable", exe)
|
|
84
|
+
monkeypatch.setattr(sys, "argv", [argv0])
|
|
85
|
+
assert recent.how_called() == want, (exe, argv0)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|