-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from a5chin/feature/tests
Add tests
- Loading branch information
Showing
36 changed files
with
448 additions
and
177 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
ARG UV_VERSION=0.5.9 | ||
ARG UV_VERSION=0.5.11 | ||
ARG DEBIAN_VERSION=bookworm | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Deploy Docs | ||
name: Docs | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
ARG DEBIAN_VERSION=bookworm | ||
ARG UV_VERSION=0.5.9 | ||
ARG UV_VERSION=0.5.11 | ||
ARG VARIANT=3.12 | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# pre-commit Configurations | ||
|
||
!!! TIP | ||
If you do not want to use the pre-commit hook, run this command: | ||
```sh | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Test Configurations | ||
|
||
## `pytest.ini` | ||
```{.ini title="pytest.ini"} | ||
[pytest] | ||
addopts = | ||
--cov=. | ||
--cov-branch | ||
--cov-fail-under=75 | ||
--cov-report=html | ||
--cov-report=term-missing | ||
--import-mode=importlib | ||
|
||
norecursedirs = | ||
.* | ||
__pycache__ | ||
htmlcov | ||
|
||
pythonpath = "." | ||
python_files = test__*.py | ||
testpaths = tests | ||
``` | ||
|
||
## Options Details | ||
|
||
### `addopts` option | ||
- `--cov=.` | ||
- Measure coverage for the current directory. | ||
- `--cov-branch` | ||
- Measure branch coverage. | ||
- `--cov-fail-under=75` | ||
- Fail if the coverage is less than 75%. | ||
- `--cov-report=html` | ||
- Generate an HTML report. | ||
- `--cov-report=term-missing` | ||
- Show missing lines in the terminal. | ||
- `--import-mode=importlib` | ||
- Use importlib to import modules. It is recommended | ||
|
||
### `norecursedirs` option | ||
Ignore directories or files that match the following patterns: | ||
|
||
- `.*` | ||
- `__pycache__` | ||
- `htmlcov` | ||
|
||
### `pythonpath` option | ||
Path specified here will be added to `sys.path` before running the tests. | ||
|
||
### `python_files` option | ||
Only files that match the pattern `test__*.py` will be considered as test files. | ||
It is recommended to reduce the number of files that pytest has to scan. | ||
|
||
### `testpaths` option | ||
Only the `tests` directory will be considered for running the tests. | ||
It is recommended to reduce the number of directories that pytest has to scan. | ||
|
||
## `settings.json` | ||
|
||
```{.json title=".vscode/settings.json"} | ||
{ | ||
"python.testing.autoTestDiscoverOnSaveEnabled": false, | ||
"python.testing.pytestEnabled": true, | ||
"python.testing.pytestArgs": [ | ||
"tests" | ||
], | ||
"python.testing.unittestEnabled": false, | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
Install Dev Container, a VS Code extension, on VS Code. | ||
Type ++command+shift+x++ on VS Code to open Extensions on the side, then type [`ms-vscode-remote.remote-containers`](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) and install the extension that comes up. | ||
|
||
![Dev Container](../img/devcontainer.png) | ||
![Dev Container](../img/devcontainer.png){ loading=lazy } | ||
/// caption | ||
Dev Container features on VS Code | ||
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Test User Guides on this repository | ||
|
||
!!! TIP | ||
Official documentation for pytest is available at [https://docs.pytest.org/en/stable](https://docs.pytest.org/en/stable) | ||
|
||
## Run pytest command | ||
```sh | ||
uv run pytest | ||
``` | ||
|
||
```sh | ||
============================================= test session starts ============================================= | ||
platform linux -- Python 3.12.6, pytest-8.3.4, pluggy-1.5.0 | ||
rootdir: /workspaces/python-uv | ||
configfile: pytest.ini | ||
testpaths: tests | ||
plugins: cov-6.0.0 | ||
collected 4 items | ||
|
||
tests/tools/test__logger.py .... [100%] | ||
|
||
---------- coverage: platform linux, python 3.12.6-final-0 ----------- | ||
Name Stmts Miss Branch BrPart Cover Missing | ||
------------------------------------------------------------------------- | ||
tests/tools/test__logger.py 24 0 0 0 100% | ||
tools/__init__.py 2 0 0 0 100% | ||
tools/logger/__init__.py 5 0 0 0 100% | ||
tools/logger/color.py 12 0 0 0 100% | ||
tools/logger/googlecloud.py 10 0 0 0 100% | ||
tools/logger/local.py 12 0 0 0 100% | ||
tools/logger/logger.py 23 0 2 0 100% | ||
tools/logger/style.py 7 0 0 0 100% | ||
tools/logger/type.py 5 0 0 0 100% | ||
------------------------------------------------------------------------- | ||
TOTAL 100 0 2 0 100% | ||
Coverage HTML written to dir htmlcov | ||
|
||
Required test coverage of 75% reached. Total coverage: 100.00% | ||
|
||
============================================== 4 passed in 2.00s ============================================== | ||
``` | ||
|
||
## Run pytest on VS Code | ||
|
||
|
||
![](../img/test_with_coverage.png){ loading=lazy } | ||
/// caption | ||
Test with coverage on VS Code | ||
/// | ||
|
||
![](../img/coverage_on_editor.png){ loading=lazy } | ||
/// caption | ||
Code coverage on editor | ||
/// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
c1cca17
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report