sts-sponsors team mailing list archive
-
sts-sponsors team
-
Mailing list archive
-
Message #06898
[Merge] ~ack/maas-site-manager:move-backend-tests into maas-site-manager:main
Alberto Donato has proposed merging ~ack/maas-site-manager:move-backend-tests into maas-site-manager:main.
Commit message:
move python tests in separate tree, adjust imports
Requested reviews:
MAAS Committers (maas-committers)
For more details, see:
https://code.launchpad.net/~ack/maas-site-manager/+git/site-manager/+merge/440854
--
Your team MAAS Committers is requested to review the proposed merge of ~ack/maas-site-manager:move-backend-tests into maas-site-manager:main.
diff --git a/backend/pyproject.toml b/backend/pyproject.toml
index f8937e5..74f6260 100644
--- a/backend/pyproject.toml
+++ b/backend/pyproject.toml
@@ -53,7 +53,7 @@ max-line-length = 79
[tool.pytest.ini_options]
asyncio_mode = "auto"
testpaths = [
- "msm/"
+ "tests/"
]
junit_logging = "all"
junit_suite_name = "maas-site-manager backend tests"
diff --git a/backend/msm/testing/__init__.py b/backend/tests/__init__.py
similarity index 100%
rename from backend/msm/testing/__init__.py
rename to backend/tests/__init__.py
diff --git a/backend/msm/conftest.py b/backend/tests/conftest.py
similarity index 80%
rename from backend/msm/conftest.py
rename to backend/tests/conftest.py
index 6dfa8ad..f5c9b21 100644
--- a/backend/msm/conftest.py
+++ b/backend/tests/conftest.py
@@ -1,8 +1,8 @@
-from .testing.app import (
+from .fixtures.app import (
user_app,
user_app_client,
)
-from .testing.db import (
+from .fixtures.db import (
db,
db_setup,
fixture,
diff --git a/backend/msm/user_api/tests/__init__.py b/backend/tests/fixtures/__init__.py
similarity index 100%
rename from backend/msm/user_api/tests/__init__.py
rename to backend/tests/fixtures/__init__.py
diff --git a/backend/msm/testing/app.py b/backend/tests/fixtures/app.py
similarity index 88%
rename from backend/msm/testing/app.py
rename to backend/tests/fixtures/app.py
index cf97465..1a379d0 100644
--- a/backend/msm/testing/app.py
+++ b/backend/tests/fixtures/app.py
@@ -7,8 +7,8 @@ from fastapi import FastAPI
from httpx import AsyncClient
import pytest
-from ..db import Database
-from ..user_api import create_app
+from msm.db import Database
+from msm.user_api import create_app
@pytest.fixture
diff --git a/backend/msm/testing/db.py b/backend/tests/fixtures/db.py
similarity index 98%
rename from backend/msm/testing/db.py
rename to backend/tests/fixtures/db.py
index f95eb2e..30848bc 100644
--- a/backend/msm/testing/db.py
+++ b/backend/tests/fixtures/db.py
@@ -9,7 +9,7 @@ from pytest_postgresql.executor import PostgreSQLExecutor
from pytest_postgresql.janitor import DatabaseJanitor
from sqlalchemy import create_engine
-from ..db import (
+from msm.db import (
Database,
METADATA,
)
diff --git a/backend/tests/user_api/__init__.py b/backend/tests/user_api/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/backend/tests/user_api/__init__.py
diff --git a/backend/msm/user_api/tests/test_handlers.py b/backend/tests/user_api/test_handlers.py
similarity index 99%
rename from backend/msm/user_api/tests/test_handlers.py
rename to backend/tests/user_api/test_handlers.py
index f7a91f3..413dde2 100644
--- a/backend/msm/user_api/tests/test_handlers.py
+++ b/backend/tests/user_api/test_handlers.py
@@ -7,7 +7,7 @@ from datetime import (
from httpx import AsyncClient
import pytest
-from ...testing.db import Fixture
+from ..fixtures.db import Fixture
def duration_format(time: timedelta, time_format: str) -> str:
diff --git a/backend/tox.ini b/backend/tox.ini
index 21f9649..25da78b 100644
--- a/backend/tox.ini
+++ b/backend/tox.ini
@@ -56,7 +56,7 @@ deps =
.[testing]
mypy
commands =
- mypy -p msm {posargs}
+ mypy {[globals]lint_files} {posargs}
[testenv:run]
deps =
@@ -67,4 +67,5 @@ commands =
[globals]
lint_files =
- msm/
+ msm/ \
+ tests/
Follow ups