Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
curskey committed Nov 4, 2023
1 parent d5f3d3b commit 897293a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
13 changes: 8 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
ci:
autoupdate_schedule: monthly

default_language_version:
python: python3.10

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.5.0
hooks:
- id: check-yaml
- id: check-toml
Expand All @@ -12,25 +15,25 @@ repos:
- id: check-added-large-files

- repo: https://github.com/asottile/pyupgrade
rev: v3.11.1
rev: v3.15.0
hooks:
- id: pyupgrade
args: ["--py310-plus"]

- repo: https://github.com/psf/black
rev: 23.7.0
rev: 23.10.1
hooks:
- id: black
args: ['--config=./pyproject.toml']

- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.286
rev: v0.1.3
hooks:
- id: ruff
args: ['--config=./pyproject.toml']

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.5.1
rev: v1.6.1
hooks:
- id: mypy
args: ['--config-file=./pyproject.toml']
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Change Log
----------
==========

Version 0.1
~~~~~~~~~~~
Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Flask-Blueprints-Loader

.. image:: https://img.shields.io/github/actions/workflow/status/curskey/flask-blueprints-loader/tests.yml?label=tests
:alt: GitHub Workflow Status (with event)

.. image:: https://img.shields.io/codecov/c/github/curskey/flask-blueprints-loader
:alt: Codecov

Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ ignore_missing_imports = true
disable_error_code = "union-attr"

[tool.pytest.ini_options]
minversion = "7.0"
pythonpath = ["src"]
testpaths = ["tests"]
filterwarnings = ["error"]
addopts = [
"-ra",
"-q",
"--cov",
]

Expand Down
2 changes: 1 addition & 1 deletion src/flask_blueprints_loader/blueprints_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def load_module(path: Path) -> ModuleType | None:
"""
try:
name = f"{path.parent}.{path.stem}"
if spec := importlib.util.spec_from_file_location(name, str(path)):
if spec := importlib.util.spec_from_file_location(name, path.as_posix()):
module = importlib.util.module_from_spec(spec)
spec.loader.exec_module(module)
return module
Expand Down
10 changes: 5 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from collections.abc import Generator
from pathlib import Path
from typing import Any
Expand All @@ -22,12 +21,13 @@ def flask_app(tmp_path) -> Flask:


@pytest.fixture()
def app(tmp_path) -> Generator[Flask, Any, None]:
def app(tmp_path, monkeypatch) -> Generator[Flask, Any, None]:
# SetUp
sys.path.insert(0, str(tmp_path))
yield flask_app(tmp_path)
monkeypatch.syspath_prepend(tmp_path.as_posix())
# sys.path.insert(0, str(tmp_path))
yield flask_app(tmp_path) # noqa: PT022
# TearDown
sys.path.remove(str(tmp_path))
# sys.path.remove(str(tmp_path))


@pytest.fixture()
Expand Down

0 comments on commit 897293a

Please sign in to comment.