From 04e7597c721d36b311b95466a4db8ca3db4c3bef Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Wed, 2 Mar 2022 17:00:23 +0100 Subject: [PATCH] WIP: Modernized pytest fixtures a bit, just enough to make it run. --- integrationtests/test_base_table_exporter_integration.py | 6 +++++- integrationtests/test_crawl_with_datamodel_problems.py | 5 +++-- integrationtests/test_datamodel_problems.py | 7 +++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/integrationtests/test_base_table_exporter_integration.py b/integrationtests/test_base_table_exporter_integration.py index 1c9158bd..9d79e857 100644 --- a/integrationtests/test_base_table_exporter_integration.py +++ b/integrationtests/test_base_table_exporter_integration.py @@ -23,6 +23,7 @@ # ** end header # import caosdb as db +import pytest from caosadvancedtools import table_export as te @@ -85,8 +86,11 @@ def setup_module(): pass +@pytest.fixture(autouse=True) def setup(): - """No further setup""" + """Same as module setup.""" + setup_module() + yield None setup_module() diff --git a/integrationtests/test_crawl_with_datamodel_problems.py b/integrationtests/test_crawl_with_datamodel_problems.py index 61fec390..0c6a145a 100644 --- a/integrationtests/test_crawl_with_datamodel_problems.py +++ b/integrationtests/test_crawl_with_datamodel_problems.py @@ -20,10 +20,11 @@ # along with this program. If not, see <https://www.gnu.org/licenses/>. # # ** end header -"""Test whether the crawler correctly identifies the data model -problems caused by a faulty model. + +"""Test whether the crawler correctly identifies the data model problems caused by a faulty model. """ + import caosdb as db from caosadvancedtools import loadFiles from caosadvancedtools.cfood import fileguide diff --git a/integrationtests/test_datamodel_problems.py b/integrationtests/test_datamodel_problems.py index 7d56f4da..3bca302d 100644 --- a/integrationtests/test_datamodel_problems.py +++ b/integrationtests/test_datamodel_problems.py @@ -44,12 +44,15 @@ def setup_module(): print(delete_exc) +@pytest.fixture(autouse=True) def setup(): - """No further setup""" + """Same as module setup.""" + setup_module() + yield None setup_module() -def teardown(): +def teardown_module(): """Clear and delete again.""" setup_module() -- GitLab