From 8ecdc2f47217db1a96bb387626d3b3c5064d4622 Mon Sep 17 00:00:00 2001 From: TShapinsky Date: Mon, 13 May 2024 09:59:05 -0600 Subject: [PATCH] address most sources of warnings in tests --- alfalfa_worker/__init__.py | 11 ----------- poetry.lock | 2 +- setup.cfg | 1 + tests/worker/test_models.py | 6 +++--- 4 files changed, 5 insertions(+), 15 deletions(-) delete mode 100644 alfalfa_worker/__init__.py diff --git a/alfalfa_worker/__init__.py b/alfalfa_worker/__init__.py deleted file mode 100644 index c3903c5e..00000000 --- a/alfalfa_worker/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# -*- coding: utf-8 -*- -from pkg_resources import DistributionNotFound, get_distribution - -try: - # Change here if project is renamed and does not equal the package name - dist_name = 'alfalfa-alfalfa_worker' - __version__ = get_distribution(dist_name).version -except DistributionNotFound: - __version__ = 'unknown' -finally: - del get_distribution, DistributionNotFound diff --git a/poetry.lock b/poetry.lock index 91d9760f..52450d9c 100644 --- a/poetry.lock +++ b/poetry.lock @@ -16,7 +16,7 @@ requests-toolbelt = "~1.0" type = "git" url = "https://github.com/nrel/alfalfa-client.git" reference = "develop" -resolved_reference = "0deb9ecc4b66961f17861d2731c39be94ef70d36" +resolved_reference = "b0b4e09cd2445e9a2832ccdc36e6091bc7611dd2" [[package]] name = "anyio" diff --git a/setup.cfg b/setup.cfg index e2836e28..abd6ae19 100644 --- a/setup.cfg +++ b/setup.cfg @@ -77,6 +77,7 @@ markers = fmu: mark tests that require fmu support, e.g., pyfmi (deselect with '-m "not fmu"') docker: mark tests that must be run within docker scale: mark tests that must ben run with multiple workers (deselect with '-m "not scale"') + api: mark tests specific to the API compliance norecursedirs = dist build diff --git a/tests/worker/test_models.py b/tests/worker/test_models.py index 0a36bc25..59f016e6 100644 --- a/tests/worker/test_models.py +++ b/tests/worker/test_models.py @@ -13,7 +13,7 @@ class TestModelsObjects: - def setup(self): + def setup_method(self): """Create the connection to the mongodatabase since we are not loading the entire framework. Note that the config params are monkeypatched in the conftest file""" connect(host=f"{os.environ['MONGO_URL']}/{os.environ['MONGO_DB_NAME']}", uuidrepresentation='standard') @@ -39,7 +39,7 @@ def test_create_and_destroy_site(self): class TestModelObjectsWithFixtures(): - def setup(self): + def setup_method(self): """Create the connection to the mongodatabase since we are not loading the entire framework. Note that the config params are monkeypatched in the conftest file""" connect(host=f"{os.environ['MONGO_URL']}/{os.environ['MONGO_DB_NAME']}", uuidrepresentation='standard') @@ -67,7 +67,7 @@ def setup(self): # TODO: grab the model object from the database and attach - def teardown(self): + def teardown_method(self): """Remove all the data that was generated during this test""" for datum in site_data: site = Site.objects(ref_id=datum['ref_id']).first()