Skip to content

Commit

Permalink
Merge branch 'main' into pokedex#2-introduces-pokemon-fetch-by-move
Browse files Browse the repository at this point in the history
  • Loading branch information
withtwoemms committed May 29, 2023
2 parents a1ab595 + f9b7db6 commit 335590d
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,6 @@ jobs:
- name: Lint with pre-commit
run: poetry run lint
- name: Run tests
run: poetry run tests
run: poetry run tests
- name: Build coverage report
run: poetry run coverage
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ It can be installed with:
pip install poetry
```

Once installed, scripts can executed using the `run` subcommand:
Once installed, scripts can executed using the `run` subcommand.
For example, the following runs tests, coverage, and linting:

```
poetry run <script>
poetry run check
```


Expand Down
66 changes: 65 additions & 1 deletion poetry.lock

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

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ requests = "2.31.0"
urllib3 = "<=1.26.16"
pydantic = "^1.10.8"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
coverage = "5.5"
black = "23.3.0"
flake8 = "6.0.0"
isort = "5.12.0"
pre-commit = "3.3.2"

[tool.poetry.scripts]
tests = "scripts:tests"
coverage = "scripts:coverage"
lint = "scripts:lint"
check = "scripts:check"
get-pokemon = "pokedex.api.__main__:go"
Expand Down
26 changes: 25 additions & 1 deletion scripts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,28 @@


def tests():
subprocess.run(["python", "-u", "-m", "unittest", "discover", "-t", "."])
run_tests_and_configure_coverage = [
# black ignore formatting:
# fmt: off
"python", "-m",
"coverage", "run", "--source", ".", "--branch", "--omit", "**tests/*,**/__*__.py",
"-m", "unittest", "discover", "-t", "."
# fmt: on
]
subprocess.run(run_tests_and_configure_coverage)


def coverage():
compile_coverage_report = [
# black ignore formatting:
# fmt: off
"python", "-m",
"coverage", "report", "-m", "--skip-empty", "--fail-under=90"
# fmt: on
]
completed_proc = subprocess.run(compile_coverage_report)
if completed_proc.returncode != 0:
exit(completed_proc.returncode)


def lint():
Expand All @@ -11,4 +32,7 @@ def lint():

def check():
tests()
print()
coverage()
print()
lint()

0 comments on commit 335590d

Please sign in to comment.