-
Notifications
You must be signed in to change notification settings - Fork 0
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 #22 from mcqueary/feature/test-refactoring
Feature/test refactoring
- Loading branch information
Showing
148 changed files
with
1,739 additions
and
67,227 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,3 +1,4 @@ | ||
.install.stamp | ||
__pycache__/ | ||
.*.swp | ||
.DS_Store | ||
|
Empty file.
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,57 +1,66 @@ | ||
.PHONY: test run help fmt install-editable lint git-setup clean testclean all commitizen coveralls | ||
|
||
# same as `export PYTHONPATH="$PWD:$PYTHONPATH"` | ||
# see also https://stackoverflow.com/a/18137056 | ||
mkfile_path := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
PYTHONPATH:=$(PYTHONPATH):$(mkfile_path):$(mkfile_path)src/graver | ||
PACKAGES:=src/graver | ||
|
||
NAME := graver | ||
INSTALL_STAMP := .install.stamp | ||
POETRY := $(shell command -v poetry 2> /dev/null) | ||
VENV?=.venv | ||
PIP=$(VENV)/bin/pip | ||
PY=$(VENV)/bin/python | ||
|
||
all: ; $(info $$PYTHONPATH is [${PYTHONPATH}]) | ||
SRC := src/$(NAME) | ||
|
||
.PHONY: test run build help fmt install install-editable lint git-setup clean realclean all commitizen | ||
.DEFAULT_GOAL := help | ||
|
||
.PHONY: help | ||
help: ## list targets with short description | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9._-]+:.*?## / {printf "\033[1m\033[36m%-38s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) | ||
|
||
cov: ## run pytest coverage report | ||
poetry run pytest --cov=graver --cov-report term-missing | ||
.PHONY: install | ||
install: $(INSTALL_STAMP) ## install project using `which poetry` from pyproject.toml | ||
$(INSTALL_STAMP): pyproject.toml poetry.lock | ||
@if [ -z $(POETRY) ]; then echo "Poetry could not be found. See https://python-poetry.org/docs/"; exit 2; fi | ||
$(POETRY) --version | ||
poetry install --with dev,test --no-ansi --no-interaction --verbose | ||
touch $(INSTALL_STAMP) | ||
|
||
coveralls: ## report coverage data to coveralls.io | ||
poetry run coveralls | ||
.PHONY: lint | ||
lint: $(INSTALL_STAMP) ## run flake8 to check the code | ||
$(POETRY) run isort --profile=black --lines-after-imports=2 --check-only tests $(SRC) | ||
$(POETRY) run black --check tests $(SRC) --diff | ||
$(POETRY) run flake8 tests $(SRC) --count --select=E9,F63,F7,F82 --show-source --statistics | ||
$(POETRY) run flake8 tests $(SRC) --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
$(POETRY) run mypy tests $(SRC) --ignore-missing-imports | ||
|
||
test: ## run pytest | ||
poetry run pytest -rA -vvs --log-level INFO | ||
.PHONY: fmt | ||
fmt: $(INSTALL_STAMP) ## run black to format the code | ||
$(POETRY) run isort --profile=black --lines-after-imports=2 tests $(SRC) | ||
$(POETRY) run black --line-length 88 $(SRC) tests | ||
|
||
lint: ## run flake8 to check the code | ||
poetry run flake8 $(PACKAGES) tests --count --select=E9,F63,F7,F82 --show-source --statistics | ||
poetry run flake8 $(PACKAGES) tests --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics | ||
.PHONY: test | ||
test: $(INSTALL_STAMP) tests ## run pytest | ||
$(POETRY) run pytest tests --cov-report term-missing --cov-fail-under 100 --cov $(NAME) --durations=10 $(ARGS) | ||
|
||
install: | ||
poetry install --with dev,test | ||
.PHONY: test-verbose | ||
test-verbose: tests ## run pytest | ||
$(POETRY) run pytest -rA -vvs --log-level INFO $(ARGS) | ||
|
||
fmt: ## run black to format the code | ||
poetry run isort $(PACKAGES) tests | ||
poetry run black -q --line-length 88 $(PACKAGES) tests | ||
.PHONY: build | ||
build: ## export requirements.txt (for standard pip install) and build dist | ||
$(POETRY) export -f requirements.txt --output requirements.txt | ||
$(POETRY) build | ||
|
||
$(VENV)/init: ## init the virtual environment | ||
python3.12 -m venv $(VENV) | ||
touch $@ | ||
. $(VENV)/bin/activate && pip install -U pip | ||
. $(VENV)/bin/activate && pip install -r requirements.txt | ||
. $(VENV)/bin/activate && pip install poetry | ||
.PHONY: clean | ||
clean: ## Delete cache and other temporary files | ||
find . -type d -name "__pycache__" | xargs rm -rf {}; | ||
rm -rf .install.stamp .coverage .mypy_cache $(VERSION_FILE) | ||
|
||
$(VENV)/requirements: requirements.txt $(VENV)/init ## install requirements | ||
$(PIP) install -r $< | ||
touch $@ | ||
.PHONY: realclean | ||
realclean: clean ## clean up everything produced by the install and build | ||
rm -rf dist/ | ||
rm -rf $(VENV) | ||
rm -f *.csv *.db *.log* tests/*.log* tests/*.db | ||
|
||
.PHONY: vcrclean | ||
vcrclean: ## clean up VCR.py cassettes | ||
rm -f tests/fixtures/vcr_cassettes/* tests/fixtures/cassettes/* | ||
|
||
.PHONY: commitizen | ||
commitizen: | ||
@cz check --commit-msg-file .git/COMMIT_EDITMSG | ||
|
||
clean: ## clean up test outputs and other temporary files | ||
rm -f *.csv | ||
rm -f *.db | ||
|
||
testclean: | ||
rm -f tests/fixtures/vcr_cassettes/* |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,6 @@ | ||
[installer] | ||
max-workers = 10 | ||
|
||
[virtualenvs] | ||
create = true | ||
in-project = true |
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 |
---|---|---|
|
@@ -2,10 +2,14 @@ | |
requires = ["graver"] | ||
build-backend = "poetry.core.masonry.api" | ||
|
||
[project] | ||
|
||
[tool.poetry] | ||
name = "graver" | ||
dynamic = ["version", "description"] | ||
authors = [{ name = "Larry McQueary", email = "[email protected]" }] | ||
version = "v0.1.0" | ||
description = "" | ||
authors = ["Larry McQueary <[email protected]>"] | ||
readme = "README.md" | ||
|
||
classifiers = [ | ||
"License :: OSI Approved :: MIT License", | ||
"Programming Language :: Python", | ||
|
@@ -16,51 +20,15 @@ classifiers = [ | |
"Programming Language :: Python :: 3.11", | ||
"Programming Language :: Python :: 3.12", | ||
] | ||
[project.urls] | ||
Home = "https://github.com/mcqueary/graver" | ||
|
||
|
||
[tool.setuptools.dynamic] | ||
version = {attr = "package.__version__"} | ||
|
||
|
||
[tool.commitizen] | ||
name = "cz_conventional_commits" | ||
version = "0.1.0" | ||
version_files = [ | ||
"src/graver/__init__.py", | ||
"pyproject.toml:version" | ||
] | ||
update_changelog_on_bump = true | ||
style = [ | ||
["qmark", "fg:#ff9d00 bold"], | ||
["question", "bold"], | ||
["answer", "fg:#ff9d00 bold"], | ||
["pointer", "fg:#ff9d00 bold"], | ||
["highlighted", "fg:#ff9d00 bold"], | ||
["selected", "fg:#cc5454"], | ||
["separator", "fg:#cc5454"], | ||
["instruction", ""], | ||
["text", ""], | ||
["disabled", "fg:#858585 italic"] | ||
] | ||
|
||
|
||
[tool.poetry] | ||
name = "graver" | ||
version = "0.1.0" | ||
description = "" | ||
authors = ["Larry McQueary <[email protected]>"] | ||
readme = "README.md" | ||
|
||
|
||
[tool.poetry.dependencies] | ||
python = ">=3.8.1,<4.0" | ||
beautifulsoup4 = "4.12.2" | ||
tqdm = "4.66.1" | ||
typer = {extras = ["all"], version = "^0.9.0"} | ||
requests = "^2.31.0" | ||
|
||
dill = "^0.3.7" | ||
types-python-dateutil = "^2.8.19.14" | ||
|
||
[tool.poetry.group.test.dependencies] | ||
coverage = ">=4.1,<6.0.dev0 || >6.1,<6.1.1 || >6.1.1,<7.0" | ||
|
@@ -70,9 +38,9 @@ pytest = "^7.4.3" | |
pytest-cov = "^4.1.0" | ||
pytest-helpers-namespace = "^2021.12.29" | ||
pytest-integration = "^0.2.3" | ||
vcrpy = "^5.1.0" | ||
requests-mock = "^1.11.0" | ||
|
||
betamax = "^0.8.1" | ||
faker = "^21.0.0" | ||
|
||
[tool.poetry.group.dev.dependencies] | ||
black = "^23.11.0" | ||
|
@@ -83,12 +51,40 @@ mypy = "^1.7.1" | |
types-beautifulsoup4 = "^4.12.0.7" | ||
types-tqdm = "^4.66.0.5" | ||
poetry-plugin-export = "^1.6.0" | ||
|
||
deadcode = "^2.2.2" | ||
types-requests = "^2.31.0.10" | ||
|
||
[tool.poetry.scripts] | ||
graver = "graver.cli:app" | ||
|
||
|
||
[tool.deadcode] | ||
exclude = [".venv", ".tox", ".trunk", "tests"] | ||
ignore-names = ["BaseTestCase", "*Mixin"] | ||
ignore-names-in-files = ["migrations"] | ||
|
||
|
||
[tool.pytest.ini_options] | ||
testpaths = ["tests"] | ||
filterwarnings = ["ignore::DeprecationWarning:betamax.*"] | ||
|
||
|
||
[tool.commitizen] | ||
name = "cz_conventional_commits" | ||
version = "v0.1.0" | ||
version_files = [ | ||
"pyproject.toml:version" | ||
] | ||
update_changelog_on_bump = true | ||
style = [ | ||
["qmark", "fg:#ff9d00 bold"], | ||
["question", "bold"], | ||
["answer", "fg:#ff9d00 bold"], | ||
["pointer", "fg:#ff9d00 bold"], | ||
["highlighted", "fg:#ff9d00 bold"], | ||
["selected", "fg:#cc5454"], | ||
["separator", "fg:#cc5454"], | ||
["instruction", ""], | ||
["text", ""], | ||
["disabled", "fg:#858585 italic"] | ||
] |
Oops, something went wrong.