Skip to content

Commit

Permalink
test: add cov, flake8, mypy, black and isort
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Louis Fuchs committed Jan 3, 2024
1 parent b08d313 commit 94ffa6d
Show file tree
Hide file tree
Showing 21 changed files with 2,220 additions and 1,934 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__pycache__
/.hypothesis
/.dmypy.json
48 changes: 43 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,52 @@ wait-for-ready: up ## wait for web-server to be ready for testing
poetry-install: wait-for-ready ## install dev environment
@docker compose exec testing poetry install

.PHONY: mypy
mypy: poetry-install
@docker compose exec testing poetry run dmypy run -- pyaptly

.PHONY: pytest
pytest: poetry-install ## run pytest
@docker compose exec testing poetry run pytest -vv --cov

.PHONY: check-isort
check-isort: poetry-install ## check isort
@docker compose exec testing poetry run isort --check pyaptly

.PHONY: check-black
check-black: poetry-install ## check black
@docker compose exec testing poetry run black --check pyaptly

.PHONY: check-black
format-black: poetry-install ## format code with black
@docker compose exec testing poetry run black pyaptly

.PHONY: flake8
flake8: poetry-install ## run flake8
@docker compose exec testing poetry run flake8 pyaptly

.PHONY: lint-code
lint-code: check-isort check-black flake8 ## check all linters

.PHONY: test
test: poetry-install ## run pytest
@docker compose exec testing poetry run pytest
test: pytest mypy lint-code ## run all testing

.PHONY: shell
shell: poetry-install ## run shell
@docker compose exec testing bash -c "SHELL=bash poetry shell"

.PHONY: entr
entr: poetry-install ## run entr
@docker compose exec testing bash -c "find -name '*.py' | SHELL=bash poetry run entr bash -c 'pytest -x --lf'"
.PHONY: entr-pytest
entr-pytest: poetry-install ## run pytest with entr
@docker compose exec testing bash -c "find -name '*.py' | SHELL=bash poetry run entr bash -c 'pytest -x --lf; echo ---'"

.PHONY: entr-mypy
entr-mypy: poetry-install ## run pytest with entr
@docker compose exec testing bash -c "find -name '*.py' | SHELL=bash poetry run entr bash -c 'make local-mypy; echo ---'"

.PHONY: entr-flake8
entr-flake8: poetry-install ## run flake8 with entr
@docker compose exec testing bash -c "find -name '*.py' | SHELL=bash poetry run entr bash -c 'flake8 pyaptly; echo ---'"

.PHONY: local-mypy
local-mypy: ## Run mypy as daemon locally (requires local-dev)
@poetry run dmypy run -- pyaptly
13 changes: 12 additions & 1 deletion TODO
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# NEXT: Add coverage and mypy

# Call code moves somewhere else

- Tests to the tests/ directory
- Everything else away from legacy.py
- Remove version.py completely

# Update old files

The following files have just been copied without checking if their content is ok:
Expand All @@ -19,4 +25,9 @@ The reason for this is to ensure the continuity of the git history.

# Replace all subprocess commands with a modern one (usually run())

# All logging should be done via logging (no stdout/stderr)
# All logging should be done via logging (no stdout/stderr)

# Remove all top-level `# type: ignore` and all `# type: ignore # TODO`

# Add good documentation to every function and module, but plan to review all of
it once everything is in place
336 changes: 217 additions & 119 deletions poetry.lock

Large diffs are not rendered by default.

Loading

0 comments on commit 94ffa6d

Please sign in to comment.