From 8a98930b9542b179d4d6e5b440c508e524888221 Mon Sep 17 00:00:00 2001 From: Maxime Vergez <85738261+mvergez@users.noreply.github.com> Date: Fri, 23 Dec 2022 10:28:17 +0100 Subject: [PATCH] test: refactor fixtures to load them automatically (#20) Need to set the current working directory of pytest the directory where the gn_monitoring_module repo is (so with the frontend etc.) --- backend/gn_module_monitoring/tests/conftest.py | 6 ++++++ .../tests/test_monitoring/test_models/test_module.py | 2 -- .../tests/test_monitoring/test_routes/test_site.py | 2 -- .../tests/test_monitoring/test_routes/test_sites_groups.py | 2 -- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/gn_module_monitoring/tests/conftest.py b/backend/gn_module_monitoring/tests/conftest.py index b0a007542..6b1107a1d 100644 --- a/backend/gn_module_monitoring/tests/conftest.py +++ b/backend/gn_module_monitoring/tests/conftest.py @@ -1,2 +1,8 @@ from geonature.tests.fixtures import * from geonature.tests.fixtures import _session, app, users + +pytest_plugins = [ + "gn_module_monitoring.tests.fixtures.module", + "gn_module_monitoring.tests.fixtures.site", + "gn_module_monitoring.tests.fixtures.sites_groups", +] diff --git a/backend/gn_module_monitoring/tests/test_monitoring/test_models/test_module.py b/backend/gn_module_monitoring/tests/test_monitoring/test_models/test_module.py index 60cca2e98..fbf606816 100644 --- a/backend/gn_module_monitoring/tests/test_monitoring/test_models/test_module.py +++ b/backend/gn_module_monitoring/tests/test_monitoring/test_models/test_module.py @@ -2,8 +2,6 @@ from geonature.utils.env import db from gn_module_monitoring.monitoring.models import TMonitoringModules -from gn_module_monitoring.tests.fixtures.module import monitoring_module -from gn_module_monitoring.tests.fixtures.site import categories, site_type @pytest.mark.usefixtures("temporary_transaction") diff --git a/backend/gn_module_monitoring/tests/test_monitoring/test_routes/test_site.py b/backend/gn_module_monitoring/tests/test_monitoring/test_routes/test_site.py index 9c7f8ac16..04dc22995 100644 --- a/backend/gn_module_monitoring/tests/test_monitoring/test_routes/test_site.py +++ b/backend/gn_module_monitoring/tests/test_monitoring/test_routes/test_site.py @@ -1,8 +1,6 @@ import pytest from flask import url_for -from gn_module_monitoring.tests.fixtures.site import categories, site_type, sites - @pytest.mark.usefixtures("client_class", "temporary_transaction") class TestSite: diff --git a/backend/gn_module_monitoring/tests/test_monitoring/test_routes/test_sites_groups.py b/backend/gn_module_monitoring/tests/test_monitoring/test_routes/test_sites_groups.py index eef8a335e..41701d18c 100644 --- a/backend/gn_module_monitoring/tests/test_monitoring/test_routes/test_sites_groups.py +++ b/backend/gn_module_monitoring/tests/test_monitoring/test_routes/test_sites_groups.py @@ -1,8 +1,6 @@ import pytest from flask import url_for -from gn_module_monitoring.tests.fixtures.sites_groups import sites_groups - @pytest.mark.usefixtures("client_class", "temporary_transaction") class TestSitesGroups: