Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added poethepoet as task runner #306

Merged
merged 2 commits into from
Jan 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,25 @@ Note that you can run `poetry install` after making a change to the krux code if

## Format code
```bash
poetry run black ./src
poetry run black ./tests
poetry run poe format
```

## Run pylint
```bash
poetry run pylint ./src
poetry run poe lint
```

## Run tests
```bash
poetry run pytest --cache-clear --cov src/krux --cov-report html ./tests
poetry run poe test
```

This will run all tests and generate a coverage report you can browse to locally in your browser at `file:///path/to/krux/htmlcov/index.html`.

For more verbose test output (e.g., to see the output of print statements), run:

```bash
poetry run pytest --cache-clear --cov src/krux --cov-report html --show-capture all --capture tee-sys -r A ./tests
poetry run poe test-verbose
```

To run just a specific test from a specific file, run:
Expand Down
53 changes: 45 additions & 8 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,26 @@ pytest-cov = "^3.0.0"
pytest-mock = "^3.6.1"
PyQRCode = "^1.2.1"
pycryptodome = "^3.17.0"
poethepoet = "^0.24.4"

[tool.poetry.extras]
docs = ["mkdocs", "mkdocs-material", "mkdocs-static-i18n", "pymdown-extensions"]
simulator = ["numpy", "opencv-python", "Pillow", "pygame", "pyzbar"]

[tool.poe.tasks]
# tasks for format code with black
# all tasks that start with `_` are'nt callable
format-src = "black ./src"
format-tests = "black ./tests"
format = ["format-src", "format-tests"]

# tasks for lint code with pylint
# all tasks that start with `_` are'nt callable
lint = "pylint ./src"

# tasks for test code
test = "poetry run pytest --cache-clear --cov src/krux --cov-report html ./tests"
test-verbose = "poetry run pytest --cache-clear --cov src/krux --cov-report html --show-capture all --capture tee-sys -r A ./tests"

# pre commit (do formatting, linting and tests)
pre-commit = ["format", "lint", "test"]
Loading