Skip to content

Commit

Permalink
Using hatch matrix for ci test (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
ischaojie authored Feb 6, 2023
1 parent fd99a66 commit e4b90a5
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 13 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install hatch
hatch env create
run: python -m pip install hatch

- name: Run linting & Test
run: hatch run all
- name: Lint
run: hatch run check

- name: Test
run: hatch run +py=${{matrix.python-version}} test:test

- name: Upload Coverage
uses: codecov/codecov-action@v3
Expand Down
1 change: 0 additions & 1 deletion flask_more/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def __init__(
self.init_app(app)

def init_app(self, app: Flask) -> None:

self.app.register_error_handler(HTTPException, self.handle_exception)

if self.docs_url:
Expand Down
1 change: 0 additions & 1 deletion flask_more/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def make_pathitem(


def make_operation(rule: Rule, view_func: Callable) -> Operation:

sig = signature(view_func)

api_desc = getattr(view_func, "__openapi__", {})
Expand Down
1 change: 0 additions & 1 deletion flask_more/wraps.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def api(

@wraps(f)
def wrapper(*args: List, **kwargs: Dict) -> Any:

errors, validated = validator(f, *args, **kwargs) # type: ignore
if errors["details"]:
return jsonify(errors), 400
Expand Down
19 changes: 14 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,13 @@ path = "flask_more/__init__.py"
[tool.hatch.envs.default]
dependencies = [
"flake8",
"pytest",
"mypy",
"black",
"black==23.1.0",
"isort",
"autoflake",
"pytest-cov",
"mkdocs",
"mkdocs-material",
"mkdocstrings[python]>=0.18",
"openapi-spec-validator",
]

[tool.hatch.envs.default.scripts]
Expand All @@ -74,11 +71,23 @@ lint = [
"isort flask_more tests",
"black flask_more tests",
]

[tool.hatch.envs.test]
dependencies = [
"pytest",
"pytest-cov",
"pytest-pretty",
"openapi-spec-validator",
]

[[tool.hatch.envs.test.matrix]]
python = ["3.8", "3.9", "3.10", "3.11"]

[tool.hatch.envs.test.scripts]
test = [
"pytest tests/ -s --cov=flask_more --cov-config=pyproject.toml --cov-report=term-missing --cov-report=xml --cov-fail-under=99",
]
report = ["coverage report -m"]
all = ["check", "test"]

[tool.black]
line-length = 90
Expand Down

0 comments on commit e4b90a5

Please sign in to comment.