AIUnitTest 0.0.1__tar.gz → 0.0.2__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.
- aiunittest-0.0.2/.github/ISSUE_TEMPLATE/bug_report.yml +50 -0
- aiunittest-0.0.2/.github/ISSUE_TEMPLATE/config.yml +8 -0
- aiunittest-0.0.2/.github/ISSUE_TEMPLATE/documentation.yml +30 -0
- aiunittest-0.0.2/.github/ISSUE_TEMPLATE/feature_request.yml +35 -0
- aiunittest-0.0.2/.github/pull_request_template.md +43 -0
- aiunittest-0.0.2/.markdownlint.yml +4 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/.pre-commit-config.yaml +3 -8
- aiunittest-0.0.2/CONTRIBUTING.md +100 -0
- aiunittest-0.0.2/PKG-INFO +159 -0
- aiunittest-0.0.2/README.md +121 -0
- aiunittest-0.0.2/src/AIUnitTest.egg-info/PKG-INFO +159 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/AIUnitTest.egg-info/SOURCES.txt +6 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/ai_unit_test/_version.py +2 -2
- aiunittest-0.0.1/.markdownlint.yml +0 -9
- aiunittest-0.0.1/PKG-INFO +0 -65
- aiunittest-0.0.1/README.md +0 -27
- aiunittest-0.0.1/src/AIUnitTest.egg-info/PKG-INFO +0 -65
- {aiunittest-0.0.1 → aiunittest-0.0.2}/.flake8 +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/.github/dependabot.yml +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/.github/workflows/ci.yml +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/.github/workflows/create-release.yml +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/.github/workflows/release.yml +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/.gitignore +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/LICENSE +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/USAGE.md +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/conda/meta.yaml +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/docs/initial.md +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/pyproject.toml +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/requirements.txt +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/reset_fake_project.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/setup.cfg +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/AIUnitTest.egg-info/dependency_links.txt +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/AIUnitTest.egg-info/requires.txt +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/AIUnitTest.egg-info/top_level.txt +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/ai_unit_test/__init__.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/ai_unit_test/cli.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/ai_unit_test/coverage_helper.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/ai_unit_test/file_helper.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/ai_unit_test/llm.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/ai_unit_test/main.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/src/ai_unit_test/py.typed +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/fake_project/pyproject.toml +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/fake_project/src/__init__.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/fake_project/src/simple_math.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/fake_project/tests/test_simple_math.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/conftest.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/create_fake_coverage.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/dummy_source.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/fake.coverage +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/fake_pyproject.toml +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/test_cli.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/test_coverage_helper.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/test_dummy_source.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/test_file_helper.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/test_llm.py +0 -0
- {aiunittest-0.0.1 → aiunittest-0.0.2}/tests/unit/test_main.py +0 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Bug Report
|
|
2
|
+
description: Create a report to help us improve.
|
|
3
|
+
title: "[BUG] - "
|
|
4
|
+
labels: ["bug", "help wanted"]
|
|
5
|
+
assignees:
|
|
6
|
+
- ofido
|
|
7
|
+
body:
|
|
8
|
+
- type: markdown
|
|
9
|
+
attributes:
|
|
10
|
+
value: |
|
|
11
|
+
Thanks for taking the time to fill out this bug report!
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: bug-description
|
|
14
|
+
attributes:
|
|
15
|
+
label: Describe the bug
|
|
16
|
+
description: A clear and concise description of what the bug is.
|
|
17
|
+
placeholder: Tell us what you see!
|
|
18
|
+
validations:
|
|
19
|
+
required: true
|
|
20
|
+
- type: textarea
|
|
21
|
+
id: steps-to-reproduce
|
|
22
|
+
attributes:
|
|
23
|
+
label: Steps to Reproduce
|
|
24
|
+
description: Steps to reproduce the behavior.
|
|
25
|
+
placeholder: "1. Go to ...\n2. Click on ...\n3. Scroll down to ...\n4. See error"
|
|
26
|
+
validations:
|
|
27
|
+
required: true
|
|
28
|
+
- type: textarea
|
|
29
|
+
id: expected-behavior
|
|
30
|
+
attributes:
|
|
31
|
+
label: Expected behavior
|
|
32
|
+
description: A clear and concise description of what you expected to happen.
|
|
33
|
+
validations:
|
|
34
|
+
required: true
|
|
35
|
+
- type: dropdown
|
|
36
|
+
id: os
|
|
37
|
+
attributes:
|
|
38
|
+
label: Operating System
|
|
39
|
+
description: What is the operating system you are using?
|
|
40
|
+
options:
|
|
41
|
+
- Windows
|
|
42
|
+
- macOS
|
|
43
|
+
- Linux
|
|
44
|
+
validations:
|
|
45
|
+
required: true
|
|
46
|
+
- type: textarea
|
|
47
|
+
id: additional-context
|
|
48
|
+
attributes:
|
|
49
|
+
label: Additional context
|
|
50
|
+
description: Add any other context about the problem here.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
blank_issues_enabled: false
|
|
2
|
+
contact_links:
|
|
3
|
+
- name: Project Documentation
|
|
4
|
+
url: https://github.com/ofido/AIUnitTest/blob/main/README.md
|
|
5
|
+
about: Please check the documentation for answers first.
|
|
6
|
+
- name: Ask a Question
|
|
7
|
+
url: https://github.com/ofido/AIUnitTest/discussions/new
|
|
8
|
+
about: Please ask and answer questions here.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Documentation Improvement
|
|
2
|
+
description: Suggest an improvement for the project's documentation.
|
|
3
|
+
title: "[DOCS] - "
|
|
4
|
+
labels: ["documentation", "help wanted"]
|
|
5
|
+
assignees:
|
|
6
|
+
- ofido
|
|
7
|
+
body:
|
|
8
|
+
- type: markdown
|
|
9
|
+
attributes:
|
|
10
|
+
value: |
|
|
11
|
+
Thanks for helping us improve the documentation!
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: improvement-area
|
|
14
|
+
attributes:
|
|
15
|
+
label: Which part of the documentation needs improvement?
|
|
16
|
+
description: Please be specific. If possible, include links to the relevant sections.
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: textarea
|
|
20
|
+
id: suggested-improvement
|
|
21
|
+
attributes:
|
|
22
|
+
label: Describe the suggested improvement
|
|
23
|
+
description: A clear and concise description of the improvement you are proposing.
|
|
24
|
+
validations:
|
|
25
|
+
required: true
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: additional-context
|
|
28
|
+
attributes:
|
|
29
|
+
label: Additional context
|
|
30
|
+
description: Add any other context, screenshots, or examples that might be helpful.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Feature Request
|
|
2
|
+
description: Suggest an idea for this project.
|
|
3
|
+
title: "[FEATURE] - "
|
|
4
|
+
labels: ["enhancement", "help wanted"]
|
|
5
|
+
assignees:
|
|
6
|
+
- ofido
|
|
7
|
+
body:
|
|
8
|
+
- type: markdown
|
|
9
|
+
attributes:
|
|
10
|
+
value: |
|
|
11
|
+
Thanks for suggesting an idea to improve this project!
|
|
12
|
+
- type: textarea
|
|
13
|
+
id: related-problem
|
|
14
|
+
attributes:
|
|
15
|
+
label: Is your feature request related to a problem?
|
|
16
|
+
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
17
|
+
validations:
|
|
18
|
+
required: true
|
|
19
|
+
- type: textarea
|
|
20
|
+
id: solution
|
|
21
|
+
attributes:
|
|
22
|
+
label: Describe the solution you'd like
|
|
23
|
+
description: A clear and concise description of what you want to happen.
|
|
24
|
+
validations:
|
|
25
|
+
required: true
|
|
26
|
+
- type: textarea
|
|
27
|
+
id: alternatives
|
|
28
|
+
attributes:
|
|
29
|
+
label: Describe alternatives you've considered
|
|
30
|
+
description: A clear and concise description of any alternative solutions or features you've considered.
|
|
31
|
+
- type: textarea
|
|
32
|
+
id: additional-context
|
|
33
|
+
attributes:
|
|
34
|
+
label: Additional context
|
|
35
|
+
description: Add any other context or screenshots about the feature request here.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Pull Request
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+
Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.
|
|
6
|
+
List any dependencies that are required for this change.
|
|
7
|
+
|
|
8
|
+
Fixes # (issue)
|
|
9
|
+
|
|
10
|
+
## Type of change
|
|
11
|
+
|
|
12
|
+
Please delete options that are not relevant.
|
|
13
|
+
|
|
14
|
+
- [ ] Bug fix (non-breaking change which fixes an issue)
|
|
15
|
+
- [ ] New feature (non-breaking change which adds functionality)
|
|
16
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
17
|
+
- [ ] This change requires a documentation update
|
|
18
|
+
|
|
19
|
+
## How Has This Been Tested
|
|
20
|
+
|
|
21
|
+
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.
|
|
22
|
+
Please also list any relevant details for your test configuration.
|
|
23
|
+
|
|
24
|
+
- [ ] Test A
|
|
25
|
+
- [ ] Test B
|
|
26
|
+
|
|
27
|
+
### Test Configuration
|
|
28
|
+
|
|
29
|
+
- Firmware version:
|
|
30
|
+
- Hardware:
|
|
31
|
+
- Toolchain:
|
|
32
|
+
- SDK:
|
|
33
|
+
|
|
34
|
+
## Checklist
|
|
35
|
+
|
|
36
|
+
- [ ] My code follows the style guidelines of this project
|
|
37
|
+
- [ ] I have performed a self-review of my own code
|
|
38
|
+
- [ ] I have commented my code, particularly in hard-to-understand areas
|
|
39
|
+
- [ ] I have made corresponding changes to the documentation
|
|
40
|
+
- [ ] My changes generate no new warnings
|
|
41
|
+
- [ ] I have added tests that prove my fix is effective or that my feature works
|
|
42
|
+
- [ ] New and existing unit tests pass locally with my changes
|
|
43
|
+
- [ ] Any dependent changes have been merged and published in downstream modules
|
|
@@ -40,15 +40,10 @@ repos:
|
|
|
40
40
|
- id: pyupgrade
|
|
41
41
|
args: ["--py3-plus", "--py313-plus"]
|
|
42
42
|
|
|
43
|
-
- repo: https://github.com/
|
|
44
|
-
rev: v0.
|
|
43
|
+
- repo: https://github.com/DavidAnson/markdownlint-cli2
|
|
44
|
+
rev: v0.18.1
|
|
45
45
|
hooks:
|
|
46
|
-
|
|
47
|
-
args:
|
|
48
|
-
- --config
|
|
49
|
-
- .markdownlint.yml
|
|
50
|
-
- scan
|
|
51
|
-
- docs
|
|
46
|
+
- id: markdownlint-cli2
|
|
52
47
|
|
|
53
48
|
- repo: https://github.com/adamchainz/blacken-docs
|
|
54
49
|
rev: 1.19.1
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Contributing to AIUnitTest
|
|
2
|
+
|
|
3
|
+
First off, thank you for considering contributing to AIUnitTest! It's people like you that make open source such a
|
|
4
|
+
great community.
|
|
5
|
+
|
|
6
|
+
We welcome any type of contribution, not only code. You can help with a, documentation, reporting bugs, or suggesting
|
|
7
|
+
new features.
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
### 1. Fork the Repository
|
|
12
|
+
|
|
13
|
+
If you don't have write access, start by forking the repository and then clone your fork to your local machine:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
git clone https://github.com/YOUR_USERNAME/AIUnitTest.git
|
|
17
|
+
cd AIUnitTest
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### 2. Set Up the Development Environment
|
|
21
|
+
|
|
22
|
+
We use `pip` and a virtual environment to manage dependencies. To get your environment set up, follow these steps:
|
|
23
|
+
|
|
24
|
+
1. **Create and activate a virtual environment:**
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python -m venv .venv
|
|
28
|
+
source .venv/bin/activate
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
2. **Install the project in editable mode with development dependencies:**
|
|
32
|
+
|
|
33
|
+
This will install the project itself, plus all the tools needed for testing and linting
|
|
34
|
+
(`pytest`, `black`, `flake8`, etc.).
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
pip install -e .[dev]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. Install Pre-Commit Hooks
|
|
41
|
+
|
|
42
|
+
We use `pre-commit` to automatically enforce code style and quality before you even commit. After installing the dependencies,
|
|
43
|
+
set up the git hooks:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pre-commit install
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Now, `pre-commit` will run automatically on every `git commit`.
|
|
50
|
+
|
|
51
|
+
## Development Workflow
|
|
52
|
+
|
|
53
|
+
1. **Create a new branch:**
|
|
54
|
+
|
|
55
|
+
Create a new branch from `main` for your feature or bug fix:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
git checkout -b your-feature-name
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
2. **Make your changes:**
|
|
62
|
+
|
|
63
|
+
Write your code, add your tests, and make sure everything works as expected.
|
|
64
|
+
|
|
65
|
+
3. **Run tests:**
|
|
66
|
+
|
|
67
|
+
Before submitting, ensure that all tests pass:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pytest
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
4. **Commit your changes:**
|
|
74
|
+
|
|
75
|
+
When you commit, the `pre-commit` hooks will run. If they fail, you'll need to fix the issues and `git add` the files
|
|
76
|
+
again before successfully committing.
|
|
77
|
+
|
|
78
|
+
5. **Push to your fork:**
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git push origin your-feature-name
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
6. **Open a Pull Request:**
|
|
85
|
+
|
|
86
|
+
Go to the original AIUnitTest repository on GitHub and open a new Pull Request. The PR template will be automatically
|
|
87
|
+
populated. Please fill it out as completely as possible.
|
|
88
|
+
|
|
89
|
+
## Code Style
|
|
90
|
+
|
|
91
|
+
- **Code formatting:** We use `black` for code formatting.
|
|
92
|
+
- **Import sorting:** We use `isort`.
|
|
93
|
+
- **Linting:** We use `flake8`.
|
|
94
|
+
- **Static Typing:** We use `mypy`.
|
|
95
|
+
|
|
96
|
+
All of these are enforced automatically by the `pre-commit` hooks, so you don't have to worry about running them manually.
|
|
97
|
+
|
|
98
|
+
## Questions?
|
|
99
|
+
|
|
100
|
+
If you have any questions, feel free to open an issue or start a discussion.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: AIUnitTest
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: CLI to generate and update Python unit tests automatically using coverage and AI
|
|
5
|
+
Author: Ofido
|
|
6
|
+
Project-URL: Homepage, https://github.com/ofido/AIUnitTest
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/ofido/AIUnitTest/issues
|
|
8
|
+
Keywords: testing,coverage,openai,automation
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Software Development :: Testing
|
|
17
|
+
Classifier: Topic :: Utilities
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: openai
|
|
22
|
+
Requires-Dist: coverage
|
|
23
|
+
Requires-Dist: typer
|
|
24
|
+
Requires-Dist: tomli
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: black; extra == "dev"
|
|
27
|
+
Requires-Dist: isort; extra == "dev"
|
|
28
|
+
Requires-Dist: flake8; extra == "dev"
|
|
29
|
+
Requires-Dist: flake8-bugbear; extra == "dev"
|
|
30
|
+
Requires-Dist: flake8-annotations; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy; extra == "dev"
|
|
32
|
+
Requires-Dist: pymarkdown; extra == "dev"
|
|
33
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# AIUnitTest
|
|
40
|
+
|
|
41
|
+
[](https://badge.fury.io/py/AIUnitTest)
|
|
42
|
+
[](https://pypi.org/project/AIUnitTest)
|
|
43
|
+
[](https://opensource.org/licenses/MIT)
|
|
44
|
+
[](https://github.com/psf/black)
|
|
45
|
+
[](https://pycqa.github.io/isort/)
|
|
46
|
+
[](https://flake8.pycqa.org/en/latest/)
|
|
47
|
+
[](https://mypy-lang.org/)
|
|
48
|
+
[](https://pytest.org)
|
|
49
|
+
[](https://coverage.readthedocs.io/)
|
|
50
|
+
[](https://github.com/ofido/AIUnitTest/actions/workflows/ci.yml)
|
|
51
|
+
[](https://github.com/ofido/AIUnitTest/commits/main)
|
|
52
|
+
[](https://github.com/ofido/AIUnitTest)
|
|
53
|
+
[](https://github.com/ofido/AIUnitTest/issues)
|
|
54
|
+
|
|
55
|
+
AIUnitTest is a command-line tool that reads your `pyproject.toml` and test coverage
|
|
56
|
+
data (`.coverage`) to generate and update missing Python unit tests using AI.
|
|
57
|
+
|
|
58
|
+
## How it Works
|
|
59
|
+
|
|
60
|
+
1. **Coverage Analysis**: The tool uses `coverage.py` to identify lines of code
|
|
61
|
+
that are not covered by your existing test suite.
|
|
62
|
+
2. **Source Code Chunking**: It breaks down the source code into logical chunks
|
|
63
|
+
(functions and classes).
|
|
64
|
+
3. **AI-Powered Test Generation**: For each chunk with uncovered lines,
|
|
65
|
+
it sends the source code and the uncovered line numbers to an AI model
|
|
66
|
+
(like OpenAI's GPT) to generate new test cases.
|
|
67
|
+
4. **Test File Updates**: The newly generated tests are appended to the
|
|
68
|
+
corresponding test file.
|
|
69
|
+
|
|
70
|
+
## Features
|
|
71
|
+
|
|
72
|
+
- **Coverage Analysis**: Uses the Coverage.py API to identify untested lines.
|
|
73
|
+
- **AI-Powered Test Generation**: Calls OpenAI GPT to create or enhance test cases.
|
|
74
|
+
- **Config-Driven**: Automatically picks up `coverage.run.source` and
|
|
75
|
+
`pytest.ini_options.testpaths` from `pyproject.toml`.
|
|
76
|
+
- **Auto Mode**: The `--auto` flag sets source and tests directories without
|
|
77
|
+
manual arguments.
|
|
78
|
+
- **Async & Parallel**: Speeds up OpenAI requests for large codebases.
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
There are two ways to install AIUnitTest:
|
|
83
|
+
|
|
84
|
+
### From PyPI
|
|
85
|
+
|
|
86
|
+
You can install the latest stable version from PyPI:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install AIUnitTest
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### From GitHub (for the latest development version)
|
|
93
|
+
|
|
94
|
+
1. **Clone the repository:**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
git clone https://github.com/ofido/AIUnitTest.git
|
|
98
|
+
cd AIUnitTest
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
2. **Install the project in editable mode:**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pip install -e .
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Usage
|
|
108
|
+
|
|
109
|
+
### Automatic Mode
|
|
110
|
+
|
|
111
|
+
The easiest way to run the tool is in automatic mode.
|
|
112
|
+
It will automatically discover your source and test folders
|
|
113
|
+
from your `pyproject.toml` file.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
ai-unit-test --auto
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Manual Mode
|
|
120
|
+
|
|
121
|
+
You can also specify the source and test folders manually:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
ai-unit-test --folders src --tests-folder tests
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Generating a Test for a Specific Function
|
|
128
|
+
|
|
129
|
+
You can also generate a test for a single function:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
ai-unit-test func my_module/my_file.py my_function
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Command-Line Options
|
|
136
|
+
|
|
137
|
+
- `--folders`: The source code folders to analyze.
|
|
138
|
+
- `--tests-folder`: The folder where the tests are located.
|
|
139
|
+
- `--coverage-file`: The path to the `.coverage` file.
|
|
140
|
+
- `--auto`: Try to discover folders/tests from `pyproject.toml`.
|
|
141
|
+
|
|
142
|
+
## Configuration
|
|
143
|
+
|
|
144
|
+
AIUnitTest uses the standard `pyproject.toml` file for configuration.
|
|
145
|
+
Here are the relevant sections:
|
|
146
|
+
|
|
147
|
+
- **`[tool.coverage.run]`**:
|
|
148
|
+
- `source`: A list of source code folders.
|
|
149
|
+
- **`[tool.pytest.ini_options]`**:
|
|
150
|
+
- `testpaths`: A list of test folders.
|
|
151
|
+
|
|
152
|
+
## Contributing
|
|
153
|
+
|
|
154
|
+
Contributions are welcome! Please feel free to submit a pull request or open an issue.
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
This project is licensed under the MIT License
|
|
159
|
+
see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# AIUnitTest
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/AIUnitTest)
|
|
4
|
+
[](https://pypi.org/project/AIUnitTest)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://github.com/psf/black)
|
|
7
|
+
[](https://pycqa.github.io/isort/)
|
|
8
|
+
[](https://flake8.pycqa.org/en/latest/)
|
|
9
|
+
[](https://mypy-lang.org/)
|
|
10
|
+
[](https://pytest.org)
|
|
11
|
+
[](https://coverage.readthedocs.io/)
|
|
12
|
+
[](https://github.com/ofido/AIUnitTest/actions/workflows/ci.yml)
|
|
13
|
+
[](https://github.com/ofido/AIUnitTest/commits/main)
|
|
14
|
+
[](https://github.com/ofido/AIUnitTest)
|
|
15
|
+
[](https://github.com/ofido/AIUnitTest/issues)
|
|
16
|
+
|
|
17
|
+
AIUnitTest is a command-line tool that reads your `pyproject.toml` and test coverage
|
|
18
|
+
data (`.coverage`) to generate and update missing Python unit tests using AI.
|
|
19
|
+
|
|
20
|
+
## How it Works
|
|
21
|
+
|
|
22
|
+
1. **Coverage Analysis**: The tool uses `coverage.py` to identify lines of code
|
|
23
|
+
that are not covered by your existing test suite.
|
|
24
|
+
2. **Source Code Chunking**: It breaks down the source code into logical chunks
|
|
25
|
+
(functions and classes).
|
|
26
|
+
3. **AI-Powered Test Generation**: For each chunk with uncovered lines,
|
|
27
|
+
it sends the source code and the uncovered line numbers to an AI model
|
|
28
|
+
(like OpenAI's GPT) to generate new test cases.
|
|
29
|
+
4. **Test File Updates**: The newly generated tests are appended to the
|
|
30
|
+
corresponding test file.
|
|
31
|
+
|
|
32
|
+
## Features
|
|
33
|
+
|
|
34
|
+
- **Coverage Analysis**: Uses the Coverage.py API to identify untested lines.
|
|
35
|
+
- **AI-Powered Test Generation**: Calls OpenAI GPT to create or enhance test cases.
|
|
36
|
+
- **Config-Driven**: Automatically picks up `coverage.run.source` and
|
|
37
|
+
`pytest.ini_options.testpaths` from `pyproject.toml`.
|
|
38
|
+
- **Auto Mode**: The `--auto` flag sets source and tests directories without
|
|
39
|
+
manual arguments.
|
|
40
|
+
- **Async & Parallel**: Speeds up OpenAI requests for large codebases.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
There are two ways to install AIUnitTest:
|
|
45
|
+
|
|
46
|
+
### From PyPI
|
|
47
|
+
|
|
48
|
+
You can install the latest stable version from PyPI:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install AIUnitTest
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### From GitHub (for the latest development version)
|
|
55
|
+
|
|
56
|
+
1. **Clone the repository:**
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
git clone https://github.com/ofido/AIUnitTest.git
|
|
60
|
+
cd AIUnitTest
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
2. **Install the project in editable mode:**
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pip install -e .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
### Automatic Mode
|
|
72
|
+
|
|
73
|
+
The easiest way to run the tool is in automatic mode.
|
|
74
|
+
It will automatically discover your source and test folders
|
|
75
|
+
from your `pyproject.toml` file.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
ai-unit-test --auto
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Manual Mode
|
|
82
|
+
|
|
83
|
+
You can also specify the source and test folders manually:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
ai-unit-test --folders src --tests-folder tests
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Generating a Test for a Specific Function
|
|
90
|
+
|
|
91
|
+
You can also generate a test for a single function:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
ai-unit-test func my_module/my_file.py my_function
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Command-Line Options
|
|
98
|
+
|
|
99
|
+
- `--folders`: The source code folders to analyze.
|
|
100
|
+
- `--tests-folder`: The folder where the tests are located.
|
|
101
|
+
- `--coverage-file`: The path to the `.coverage` file.
|
|
102
|
+
- `--auto`: Try to discover folders/tests from `pyproject.toml`.
|
|
103
|
+
|
|
104
|
+
## Configuration
|
|
105
|
+
|
|
106
|
+
AIUnitTest uses the standard `pyproject.toml` file for configuration.
|
|
107
|
+
Here are the relevant sections:
|
|
108
|
+
|
|
109
|
+
- **`[tool.coverage.run]`**:
|
|
110
|
+
- `source`: A list of source code folders.
|
|
111
|
+
- **`[tool.pytest.ini_options]`**:
|
|
112
|
+
- `testpaths`: A list of test folders.
|
|
113
|
+
|
|
114
|
+
## Contributing
|
|
115
|
+
|
|
116
|
+
Contributions are welcome! Please feel free to submit a pull request or open an issue.
|
|
117
|
+
|
|
118
|
+
## License
|
|
119
|
+
|
|
120
|
+
This project is licensed under the MIT License
|
|
121
|
+
see the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: AIUnitTest
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: CLI to generate and update Python unit tests automatically using coverage and AI
|
|
5
|
+
Author: Ofido
|
|
6
|
+
Project-URL: Homepage, https://github.com/ofido/AIUnitTest
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/ofido/AIUnitTest/issues
|
|
8
|
+
Keywords: testing,coverage,openai,automation
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: Software Development :: Testing
|
|
17
|
+
Classifier: Topic :: Utilities
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: openai
|
|
22
|
+
Requires-Dist: coverage
|
|
23
|
+
Requires-Dist: typer
|
|
24
|
+
Requires-Dist: tomli
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: black; extra == "dev"
|
|
27
|
+
Requires-Dist: isort; extra == "dev"
|
|
28
|
+
Requires-Dist: flake8; extra == "dev"
|
|
29
|
+
Requires-Dist: flake8-bugbear; extra == "dev"
|
|
30
|
+
Requires-Dist: flake8-annotations; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy; extra == "dev"
|
|
32
|
+
Requires-Dist: pymarkdown; extra == "dev"
|
|
33
|
+
Requires-Dist: pre-commit; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
36
|
+
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
# AIUnitTest
|
|
40
|
+
|
|
41
|
+
[](https://badge.fury.io/py/AIUnitTest)
|
|
42
|
+
[](https://pypi.org/project/AIUnitTest)
|
|
43
|
+
[](https://opensource.org/licenses/MIT)
|
|
44
|
+
[](https://github.com/psf/black)
|
|
45
|
+
[](https://pycqa.github.io/isort/)
|
|
46
|
+
[](https://flake8.pycqa.org/en/latest/)
|
|
47
|
+
[](https://mypy-lang.org/)
|
|
48
|
+
[](https://pytest.org)
|
|
49
|
+
[](https://coverage.readthedocs.io/)
|
|
50
|
+
[](https://github.com/ofido/AIUnitTest/actions/workflows/ci.yml)
|
|
51
|
+
[](https://github.com/ofido/AIUnitTest/commits/main)
|
|
52
|
+
[](https://github.com/ofido/AIUnitTest)
|
|
53
|
+
[](https://github.com/ofido/AIUnitTest/issues)
|
|
54
|
+
|
|
55
|
+
AIUnitTest is a command-line tool that reads your `pyproject.toml` and test coverage
|
|
56
|
+
data (`.coverage`) to generate and update missing Python unit tests using AI.
|
|
57
|
+
|
|
58
|
+
## How it Works
|
|
59
|
+
|
|
60
|
+
1. **Coverage Analysis**: The tool uses `coverage.py` to identify lines of code
|
|
61
|
+
that are not covered by your existing test suite.
|
|
62
|
+
2. **Source Code Chunking**: It breaks down the source code into logical chunks
|
|
63
|
+
(functions and classes).
|
|
64
|
+
3. **AI-Powered Test Generation**: For each chunk with uncovered lines,
|
|
65
|
+
it sends the source code and the uncovered line numbers to an AI model
|
|
66
|
+
(like OpenAI's GPT) to generate new test cases.
|
|
67
|
+
4. **Test File Updates**: The newly generated tests are appended to the
|
|
68
|
+
corresponding test file.
|
|
69
|
+
|
|
70
|
+
## Features
|
|
71
|
+
|
|
72
|
+
- **Coverage Analysis**: Uses the Coverage.py API to identify untested lines.
|
|
73
|
+
- **AI-Powered Test Generation**: Calls OpenAI GPT to create or enhance test cases.
|
|
74
|
+
- **Config-Driven**: Automatically picks up `coverage.run.source` and
|
|
75
|
+
`pytest.ini_options.testpaths` from `pyproject.toml`.
|
|
76
|
+
- **Auto Mode**: The `--auto` flag sets source and tests directories without
|
|
77
|
+
manual arguments.
|
|
78
|
+
- **Async & Parallel**: Speeds up OpenAI requests for large codebases.
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
There are two ways to install AIUnitTest:
|
|
83
|
+
|
|
84
|
+
### From PyPI
|
|
85
|
+
|
|
86
|
+
You can install the latest stable version from PyPI:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pip install AIUnitTest
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### From GitHub (for the latest development version)
|
|
93
|
+
|
|
94
|
+
1. **Clone the repository:**
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
git clone https://github.com/ofido/AIUnitTest.git
|
|
98
|
+
cd AIUnitTest
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
2. **Install the project in editable mode:**
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
pip install -e .
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Usage
|
|
108
|
+
|
|
109
|
+
### Automatic Mode
|
|
110
|
+
|
|
111
|
+
The easiest way to run the tool is in automatic mode.
|
|
112
|
+
It will automatically discover your source and test folders
|
|
113
|
+
from your `pyproject.toml` file.
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
ai-unit-test --auto
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Manual Mode
|
|
120
|
+
|
|
121
|
+
You can also specify the source and test folders manually:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
ai-unit-test --folders src --tests-folder tests
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Generating a Test for a Specific Function
|
|
128
|
+
|
|
129
|
+
You can also generate a test for a single function:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
ai-unit-test func my_module/my_file.py my_function
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Command-Line Options
|
|
136
|
+
|
|
137
|
+
- `--folders`: The source code folders to analyze.
|
|
138
|
+
- `--tests-folder`: The folder where the tests are located.
|
|
139
|
+
- `--coverage-file`: The path to the `.coverage` file.
|
|
140
|
+
- `--auto`: Try to discover folders/tests from `pyproject.toml`.
|
|
141
|
+
|
|
142
|
+
## Configuration
|
|
143
|
+
|
|
144
|
+
AIUnitTest uses the standard `pyproject.toml` file for configuration.
|
|
145
|
+
Here are the relevant sections:
|
|
146
|
+
|
|
147
|
+
- **`[tool.coverage.run]`**:
|
|
148
|
+
- `source`: A list of source code folders.
|
|
149
|
+
- **`[tool.pytest.ini_options]`**:
|
|
150
|
+
- `testpaths`: A list of test folders.
|
|
151
|
+
|
|
152
|
+
## Contributing
|
|
153
|
+
|
|
154
|
+
Contributions are welcome! Please feel free to submit a pull request or open an issue.
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
This project is licensed under the MIT License
|
|
159
|
+
see the [LICENSE](LICENSE) file for details.
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
.gitignore
|
|
3
3
|
.markdownlint.yml
|
|
4
4
|
.pre-commit-config.yaml
|
|
5
|
+
CONTRIBUTING.md
|
|
5
6
|
LICENSE
|
|
6
7
|
README.md
|
|
7
8
|
USAGE.md
|
|
@@ -9,6 +10,11 @@ pyproject.toml
|
|
|
9
10
|
requirements.txt
|
|
10
11
|
reset_fake_project.py
|
|
11
12
|
.github/dependabot.yml
|
|
13
|
+
.github/pull_request_template.md
|
|
14
|
+
.github/ISSUE_TEMPLATE/bug_report.yml
|
|
15
|
+
.github/ISSUE_TEMPLATE/config.yml
|
|
16
|
+
.github/ISSUE_TEMPLATE/documentation.yml
|
|
17
|
+
.github/ISSUE_TEMPLATE/feature_request.yml
|
|
12
18
|
.github/workflows/ci.yml
|
|
13
19
|
.github/workflows/create-release.yml
|
|
14
20
|
.github/workflows/release.yml
|
aiunittest-0.0.1/PKG-INFO
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: AIUnitTest
|
|
3
|
-
Version: 0.0.1
|
|
4
|
-
Summary: CLI to generate and update Python unit tests automatically using coverage and AI
|
|
5
|
-
Author: Ofido
|
|
6
|
-
Project-URL: Homepage, https://github.com/ofido/AIUnitTest
|
|
7
|
-
Project-URL: Bug Tracker, https://github.com/ofido/AIUnitTest/issues
|
|
8
|
-
Keywords: testing,coverage,openai,automation
|
|
9
|
-
Classifier: Development Status :: 3 - Alpha
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Classifier: Topic :: Software Development :: Testing
|
|
17
|
-
Classifier: Topic :: Utilities
|
|
18
|
-
Requires-Python: >=3.10
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
License-File: LICENSE
|
|
21
|
-
Requires-Dist: openai
|
|
22
|
-
Requires-Dist: coverage
|
|
23
|
-
Requires-Dist: typer
|
|
24
|
-
Requires-Dist: tomli
|
|
25
|
-
Provides-Extra: dev
|
|
26
|
-
Requires-Dist: black; extra == "dev"
|
|
27
|
-
Requires-Dist: isort; extra == "dev"
|
|
28
|
-
Requires-Dist: flake8; extra == "dev"
|
|
29
|
-
Requires-Dist: flake8-bugbear; extra == "dev"
|
|
30
|
-
Requires-Dist: flake8-annotations; extra == "dev"
|
|
31
|
-
Requires-Dist: mypy; extra == "dev"
|
|
32
|
-
Requires-Dist: pymarkdown; extra == "dev"
|
|
33
|
-
Requires-Dist: pre-commit; extra == "dev"
|
|
34
|
-
Requires-Dist: pytest; extra == "dev"
|
|
35
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
36
|
-
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
37
|
-
Dynamic: license-file
|
|
38
|
-
|
|
39
|
-
# AIUnitTest
|
|
40
|
-
|
|
41
|
-
AIUnitTest is a command-line tool that reads your `pyproject.toml` and
|
|
42
|
-
test coverage data (`.coverage`) to generate and update missing Python
|
|
43
|
-
unit tests using AI.
|
|
44
|
-
|
|
45
|
-
## Features
|
|
46
|
-
|
|
47
|
-
- **Coverage Analysis**: Uses Coverage.py API to identify untested lines.
|
|
48
|
-
- **AI-Powered Test Generation**: Calls OpenAI GPT to create or enhance test cases.
|
|
49
|
-
- **Config-Driven**: Automatically picks up `coverage.run.source` and `pytest.ini_options.testpaths` from `pyproject.toml`.
|
|
50
|
-
- **Auto Mode**: `--auto` flag sets source and tests directories without manual arguments.
|
|
51
|
-
- **Async & Parallel**: Speeds up OpenAI requests for large codebases.
|
|
52
|
-
|
|
53
|
-
## How to Run
|
|
54
|
-
|
|
55
|
-
1. **Install the project:**
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
pip install .
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
2. **Run the script:**
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
ai-unit-test --auto
|
|
65
|
-
```
|
aiunittest-0.0.1/README.md
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# AIUnitTest
|
|
2
|
-
|
|
3
|
-
AIUnitTest is a command-line tool that reads your `pyproject.toml` and
|
|
4
|
-
test coverage data (`.coverage`) to generate and update missing Python
|
|
5
|
-
unit tests using AI.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- **Coverage Analysis**: Uses Coverage.py API to identify untested lines.
|
|
10
|
-
- **AI-Powered Test Generation**: Calls OpenAI GPT to create or enhance test cases.
|
|
11
|
-
- **Config-Driven**: Automatically picks up `coverage.run.source` and `pytest.ini_options.testpaths` from `pyproject.toml`.
|
|
12
|
-
- **Auto Mode**: `--auto` flag sets source and tests directories without manual arguments.
|
|
13
|
-
- **Async & Parallel**: Speeds up OpenAI requests for large codebases.
|
|
14
|
-
|
|
15
|
-
## How to Run
|
|
16
|
-
|
|
17
|
-
1. **Install the project:**
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
pip install .
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
2. **Run the script:**
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
ai-unit-test --auto
|
|
27
|
-
```
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: AIUnitTest
|
|
3
|
-
Version: 0.0.1
|
|
4
|
-
Summary: CLI to generate and update Python unit tests automatically using coverage and AI
|
|
5
|
-
Author: Ofido
|
|
6
|
-
Project-URL: Homepage, https://github.com/ofido/AIUnitTest
|
|
7
|
-
Project-URL: Bug Tracker, https://github.com/ofido/AIUnitTest/issues
|
|
8
|
-
Keywords: testing,coverage,openai,automation
|
|
9
|
-
Classifier: Development Status :: 3 - Alpha
|
|
10
|
-
Classifier: Intended Audience :: Developers
|
|
11
|
-
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
-
Classifier: Topic :: Software Development :: Testing
|
|
17
|
-
Classifier: Topic :: Utilities
|
|
18
|
-
Requires-Python: >=3.10
|
|
19
|
-
Description-Content-Type: text/markdown
|
|
20
|
-
License-File: LICENSE
|
|
21
|
-
Requires-Dist: openai
|
|
22
|
-
Requires-Dist: coverage
|
|
23
|
-
Requires-Dist: typer
|
|
24
|
-
Requires-Dist: tomli
|
|
25
|
-
Provides-Extra: dev
|
|
26
|
-
Requires-Dist: black; extra == "dev"
|
|
27
|
-
Requires-Dist: isort; extra == "dev"
|
|
28
|
-
Requires-Dist: flake8; extra == "dev"
|
|
29
|
-
Requires-Dist: flake8-bugbear; extra == "dev"
|
|
30
|
-
Requires-Dist: flake8-annotations; extra == "dev"
|
|
31
|
-
Requires-Dist: mypy; extra == "dev"
|
|
32
|
-
Requires-Dist: pymarkdown; extra == "dev"
|
|
33
|
-
Requires-Dist: pre-commit; extra == "dev"
|
|
34
|
-
Requires-Dist: pytest; extra == "dev"
|
|
35
|
-
Requires-Dist: pytest-cov; extra == "dev"
|
|
36
|
-
Requires-Dist: pytest-asyncio; extra == "dev"
|
|
37
|
-
Dynamic: license-file
|
|
38
|
-
|
|
39
|
-
# AIUnitTest
|
|
40
|
-
|
|
41
|
-
AIUnitTest is a command-line tool that reads your `pyproject.toml` and
|
|
42
|
-
test coverage data (`.coverage`) to generate and update missing Python
|
|
43
|
-
unit tests using AI.
|
|
44
|
-
|
|
45
|
-
## Features
|
|
46
|
-
|
|
47
|
-
- **Coverage Analysis**: Uses Coverage.py API to identify untested lines.
|
|
48
|
-
- **AI-Powered Test Generation**: Calls OpenAI GPT to create or enhance test cases.
|
|
49
|
-
- **Config-Driven**: Automatically picks up `coverage.run.source` and `pytest.ini_options.testpaths` from `pyproject.toml`.
|
|
50
|
-
- **Auto Mode**: `--auto` flag sets source and tests directories without manual arguments.
|
|
51
|
-
- **Async & Parallel**: Speeds up OpenAI requests for large codebases.
|
|
52
|
-
|
|
53
|
-
## How to Run
|
|
54
|
-
|
|
55
|
-
1. **Install the project:**
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
pip install .
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
2. **Run the script:**
|
|
62
|
-
|
|
63
|
-
```bash
|
|
64
|
-
ai-unit-test --auto
|
|
65
|
-
```
|
|
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
|