AIUnitTest 0.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. aiunittest-0.0.1/.flake8 +7 -0
  2. aiunittest-0.0.1/.github/dependabot.yml +21 -0
  3. aiunittest-0.0.1/.github/workflows/ci.yml +101 -0
  4. aiunittest-0.0.1/.github/workflows/create-release.yml +53 -0
  5. aiunittest-0.0.1/.github/workflows/release.yml +60 -0
  6. aiunittest-0.0.1/.gitignore +210 -0
  7. aiunittest-0.0.1/.markdownlint.yml +9 -0
  8. aiunittest-0.0.1/.pre-commit-config.yaml +81 -0
  9. aiunittest-0.0.1/LICENSE +201 -0
  10. aiunittest-0.0.1/PKG-INFO +65 -0
  11. aiunittest-0.0.1/README.md +27 -0
  12. aiunittest-0.0.1/USAGE.md +33 -0
  13. aiunittest-0.0.1/conda/meta.yaml +36 -0
  14. aiunittest-0.0.1/docs/initial.md +88 -0
  15. aiunittest-0.0.1/pyproject.toml +136 -0
  16. aiunittest-0.0.1/requirements.txt +16 -0
  17. aiunittest-0.0.1/reset_fake_project.py +17 -0
  18. aiunittest-0.0.1/setup.cfg +4 -0
  19. aiunittest-0.0.1/src/AIUnitTest.egg-info/PKG-INFO +65 -0
  20. aiunittest-0.0.1/src/AIUnitTest.egg-info/SOURCES.txt +44 -0
  21. aiunittest-0.0.1/src/AIUnitTest.egg-info/dependency_links.txt +1 -0
  22. aiunittest-0.0.1/src/AIUnitTest.egg-info/requires.txt +17 -0
  23. aiunittest-0.0.1/src/AIUnitTest.egg-info/top_level.txt +1 -0
  24. aiunittest-0.0.1/src/ai_unit_test/__init__.py +0 -0
  25. aiunittest-0.0.1/src/ai_unit_test/_version.py +21 -0
  26. aiunittest-0.0.1/src/ai_unit_test/cli.py +286 -0
  27. aiunittest-0.0.1/src/ai_unit_test/coverage_helper.py +30 -0
  28. aiunittest-0.0.1/src/ai_unit_test/file_helper.py +99 -0
  29. aiunittest-0.0.1/src/ai_unit_test/llm.py +93 -0
  30. aiunittest-0.0.1/src/ai_unit_test/main.py +28 -0
  31. aiunittest-0.0.1/src/ai_unit_test/py.typed +0 -0
  32. aiunittest-0.0.1/tests/fake_project/pyproject.toml +14 -0
  33. aiunittest-0.0.1/tests/fake_project/src/__init__.py +0 -0
  34. aiunittest-0.0.1/tests/fake_project/src/simple_math.py +6 -0
  35. aiunittest-0.0.1/tests/fake_project/tests/test_simple_math.py +6 -0
  36. aiunittest-0.0.1/tests/unit/conftest.py +16 -0
  37. aiunittest-0.0.1/tests/unit/create_fake_coverage.py +43 -0
  38. aiunittest-0.0.1/tests/unit/dummy_source.py +2 -0
  39. aiunittest-0.0.1/tests/unit/fake.coverage +0 -0
  40. aiunittest-0.0.1/tests/unit/fake_pyproject.toml +6 -0
  41. aiunittest-0.0.1/tests/unit/test_cli.py +365 -0
  42. aiunittest-0.0.1/tests/unit/test_coverage_helper.py +53 -0
  43. aiunittest-0.0.1/tests/unit/test_dummy_source.py +2 -0
  44. aiunittest-0.0.1/tests/unit/test_file_helper.py +247 -0
  45. aiunittest-0.0.1/tests/unit/test_llm.py +83 -0
  46. aiunittest-0.0.1/tests/unit/test_main.py +22 -0
@@ -0,0 +1,7 @@
1
+ [flake8]
2
+ statistics=true
3
+ count=True
4
+ max-line-length = 120
5
+ extend-select = B, ANN
6
+ max-complexity = 10
7
+ exclude = env, .venv, build, dist, __pycache__, assets, tests/fake_project
@@ -0,0 +1,21 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly" # frequência de update (daily/weekly/monthly)
7
+ commit-message:
8
+ prefix: "chore"
9
+ include: "scope"
10
+ open-pull-requests-limit: 5
11
+ groups:
12
+ python-deps:
13
+ patterns:
14
+ - "*" # agrupar todas as dependências em um PR
15
+ - package-ecosystem: "github-actions"
16
+ directory: "/"
17
+ schedule:
18
+ interval: "weekly"
19
+ commit-message:
20
+ prefix: "chore"
21
+ include: "scope"
@@ -0,0 +1,101 @@
1
+ name: CI Pipelines
2
+
3
+ on:
4
+ pull_request:
5
+ branches: [main]
6
+
7
+ jobs:
8
+ setup:
9
+ name: Setup & Lint
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Setup Python 3.13 (with pip cache)
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: "3.13"
19
+ cache: pip # ativa cache de dependencies pip :contentReference[oaicite:1]{index=1}
20
+
21
+ - name: Cache pre-commit environment
22
+ uses: actions/cache@v4
23
+ id: precommit-cache
24
+ with:
25
+ path: ~/.cache/pre-commit/
26
+ key: precommit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
27
+ restore-keys: |
28
+ precommit-${{ runner.os }}-
29
+
30
+ - name: Install dependencies
31
+ run: pip install -r requirements.txt
32
+
33
+ - name: Install project
34
+ run: pip install -e .
35
+
36
+ - name: Run pre-commit hooks
37
+ run: pre-commit run --show-diff-on-failure --all-files
38
+
39
+ test:
40
+ name: Tests & Coverage
41
+ needs: setup
42
+ runs-on: ubuntu-latest
43
+ permissions:
44
+ contents: read
45
+ pull-requests: write
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+
49
+ - uses: actions/setup-python@v5
50
+ with:
51
+ python-version: "3.13"
52
+ cache: pip
53
+
54
+ - name: Install dependencies
55
+ run: pip install -r requirements.txt
56
+
57
+ - name: Install project
58
+ run: pip install -e .
59
+
60
+ - name: Run pytest with coverage
61
+ run: |
62
+ pytest --cov=src --cov-report=xml --cov-fail-under=80
63
+
64
+ - name: Upload coverage report
65
+ uses: actions/upload-artifact@v4
66
+ with:
67
+ name: coverage-report
68
+ path: coverage.xml
69
+
70
+ - name: Get Cover
71
+ uses: orgoro/coverage@v3.2
72
+ with:
73
+ coverageFile: coverage.xml
74
+ token: ${{ secrets.GITHUB_TOKEN }}
75
+
76
+ dependabot:
77
+ name: Dependabot PR Validation
78
+ if: github.event.pull_request.user.login == 'dependabot[bot]'
79
+ runs-on: ubuntu-latest
80
+ permissions:
81
+ contents: read
82
+ pull-requests: write
83
+ steps:
84
+ - uses: actions/checkout@v4
85
+ - uses: actions/setup-python@v5
86
+ with:
87
+ python-version: "3.13"
88
+ cache: pip
89
+ - name: Install dependencies
90
+ run: pip install -r requirements.txt
91
+
92
+ - name: Run tests
93
+ run: pytest
94
+
95
+ - name: Add label for dependencies
96
+ id: fetch-metadata
97
+ uses: dependabot/fetch-metadata@v2
98
+
99
+ - name: Label dependabot PR
100
+ if: steps.fetch-metadata.outputs.dependency-type == 'direct:production'
101
+ run: gh pr edit ${{ github.event.pull_request.html_url }} --add-label "dependencies"
@@ -0,0 +1,53 @@
1
+ name: Create Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ create_release:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write # Para criar a tag e o release
13
+
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v4
17
+ with:
18
+ fetch-depth: 0 # Necessário para obter todas as tags
19
+
20
+ - name: Get latest version and calculate next
21
+ id: get_next_version
22
+ run: |
23
+ LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
24
+ echo "Latest tag: $LATEST_TAG"
25
+
26
+ # Remove 'v' prefix and split into parts
27
+ VERSION_PARTS=$(echo $LATEST_TAG | sed 's/^v//' | tr '.' '\n')
28
+ MAJOR=$(echo $VERSION_PARTS | awk '{print $1}')
29
+ MINOR=$(echo $VERSION_PARTS | awk '{print $2}')
30
+ PATCH=$(echo $VERSION_PARTS | awk '{print $3}')
31
+
32
+ # Increment patch version
33
+ NEXT_PATCH=$((PATCH + 1))
34
+ NEXT_VERSION="v${MAJOR}.${MINOR}.${NEXT_PATCH}"
35
+ echo "Next version: $NEXT_VERSION"
36
+
37
+ echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_OUTPUT
38
+
39
+ - name: Create new tag
40
+ run: |
41
+ git config user.name "github-actions[bot]"
42
+ git config user.email "github-actions[bot]@users.noreply.github.com"
43
+ git tag -a ${{ steps.get_next_version.outputs.NEXT_VERSION }} -m "Release ${{ steps.get_next_version.outputs.NEXT_VERSION }}"
44
+ git push origin ${{ steps.get_next_version.outputs.NEXT_VERSION }}
45
+
46
+ - name: Create GitHub Release
47
+ uses: softprops/action-gh-release@v1
48
+ with:
49
+ tag_name: ${{ steps.get_next_version.outputs.NEXT_VERSION }}
50
+ name: Release ${{ steps.get_next_version.outputs.NEXT_VERSION }}
51
+ body: Automated release created on push to main.
52
+ draft: false
53
+ prerelease: false
@@ -0,0 +1,60 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ release:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ contents: write # Para criar o release e a tag
12
+ id-token: write # Para autenticação no PyPI
13
+
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v4
17
+ with:
18
+ fetch-depth: 0 # Necessário para setuptools_scm
19
+
20
+ - name: Set up Python
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: "3.x"
24
+
25
+ - name: Install build dependencies
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install setuptools_scm build twine
29
+
30
+ - name: Build package
31
+ run: python -m build
32
+
33
+ - name: Create GitHub Release
34
+ uses: softprops/action-gh-release@v1
35
+ with:
36
+ tag_name: ${{ github.event.release.tag_name }}
37
+ name: Release ${{ github.event.release.tag_name }}
38
+ body: Automated release based on GitHub release event.
39
+ draft: false
40
+ prerelease: false
41
+ files: dist/*
42
+
43
+ - name: Publish to PyPI
44
+ uses: pypa/gh-action-pypi-publish@release/v1
45
+
46
+ - name: Set up Conda
47
+ uses: conda-incubator/setup-miniconda@v3
48
+ with:
49
+ python-version: 3.x
50
+ auto-update-conda: true
51
+ auto-activate-base: false
52
+
53
+ - name: Build and upload Conda package
54
+ shell: bash -l {0}
55
+ run: |
56
+ conda install -c conda-forge conda-build anaconda-client -y
57
+ export GIT_TAG=${{ github.event.release.tag_name }}
58
+ conda build conda --output-folder conda-dist
59
+ anaconda login --with-token ${{ secrets.CONDA_TOKEN }}
60
+ anaconda upload conda-dist/**/*.tar.bz2 --label main --skip-existing
@@ -0,0 +1,210 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
208
+ tasks.md
209
+ .vscode/settings.json
210
+ src/ai_unit_test/_version.py
@@ -0,0 +1,9 @@
1
+ plugins:
2
+ md013:
3
+ enabled: true
4
+ line_length: 120
5
+ heading_line_length: 120
6
+ code_block_line_length: 120
7
+ extensions:
8
+ front-matter:
9
+ enabled: true
@@ -0,0 +1,81 @@
1
+ default_install_hook_types:
2
+ - pre-commit
3
+ - commit-msg
4
+ repos:
5
+ - repo: https://github.com/pre-commit/pre-commit-hooks
6
+ rev: v5.0.0
7
+ hooks:
8
+ - id: check-yaml
9
+ args: ["--unsafe"]
10
+ - id: end-of-file-fixer
11
+ - id: trailing-whitespace
12
+ - id: check-merge-conflict
13
+ - id: check-toml
14
+ - id: check-xml
15
+ - id: check-case-conflict
16
+ - id: check-added-large-files
17
+ args: ["--maxkb=500"] # por ex. limites de 500 KB
18
+
19
+ - repo: https://github.com/compilerla/conventional-pre-commit
20
+ rev: v4.2.0
21
+ hooks:
22
+ - id: conventional-pre-commit
23
+ stages:
24
+ - commit-msg
25
+
26
+ - repo: https://github.com/pycqa/isort
27
+ rev: 6.0.1
28
+ hooks:
29
+ - id: isort
30
+
31
+ - repo: https://github.com/psf/black
32
+ rev: 25.1.0
33
+ hooks:
34
+ - id: black
35
+ args: ["--config", "pyproject.toml"]
36
+
37
+ - repo: https://github.com/asottile/pyupgrade
38
+ rev: v3.20.0
39
+ hooks:
40
+ - id: pyupgrade
41
+ args: ["--py3-plus", "--py313-plus"]
42
+
43
+ - repo: https://github.com/jackdewinter/pymarkdown
44
+ rev: v0.9.31
45
+ hooks:
46
+ - id: pymarkdown
47
+ args:
48
+ - --config
49
+ - .markdownlint.yml
50
+ - scan
51
+ - docs
52
+
53
+ - repo: https://github.com/adamchainz/blacken-docs
54
+ rev: 1.19.1
55
+ hooks:
56
+ - id: blacken-docs
57
+ additional_dependencies:
58
+ - black==25.1.0
59
+
60
+ - repo: https://github.com/pycqa/flake8
61
+ rev: 7.3.0
62
+ hooks:
63
+ - id: flake8
64
+ additional_dependencies: [flake8-bugbear, flake8-annotations]
65
+ args: ["--config", ".flake8"]
66
+
67
+ - repo: https://github.com/PyCQA/bandit
68
+ rev: 1.8.6
69
+ hooks:
70
+ - id: bandit
71
+ args: ["-c", "pyproject.toml"]
72
+ additional_dependencies: ["bandit[toml]"]
73
+ stages:
74
+ - "pre-commit"
75
+
76
+ - repo: https://github.com/pre-commit/mirrors-mypy
77
+ rev: v1.17.1
78
+ hooks:
79
+ - id: mypy
80
+ args: ["--config-file", "pyproject.toml"]
81
+ additional_dependencies: ["typer", "openai", "coverage", "pytest"]