diff --git a/api/app/tests/conftest.py b/api/app/tests/conftest.py index 412911cb1..aa39f71bb 100644 --- a/api/app/tests/conftest.py +++ b/api/app/tests/conftest.py @@ -8,7 +8,6 @@ import requests import pytest from pytest_mock import MockerFixture -from pytest_bdd import then, parsers from app.db.models.weather_models import PredictionModel, PredictionModelRunTimestamp import app.utils.s3 from app.utils.time import get_pst_tz, get_utc_now @@ -29,7 +28,6 @@ from app.schemas.shared import WeatherDataRequest import app.wildfire_one.wildfire_fetchers import app.utils.redis -from app.tests import load_json_file logger = logging.getLogger(__name__) @@ -174,6 +172,7 @@ def mock_sentry(monkeypatch): """Mock sentrys' set_user function""" def mock_sentry(*args, **kwargs): + """No-op""" pass monkeypatch.setattr("app.auth.set_user", mock_sentry) @@ -199,30 +198,3 @@ def mock_client_session(monkeypatch): def spy_access_logging(mocker: MockerFixture): """Spies on access audting logging for tests""" return mocker.spy(auth, "create_api_access_audit_log") - - -@then(parsers.parse("the response status code is {status}"), converters={"status": int}) -def assert_status_code(response, status: int): - """Assert that we receive the expected status code""" - assert response["response"].status_code == status - - -@then("the response isn't cached") -def then_response_not_cached(response): - """Check that the response isn't being cached""" - if response["response"].status_code == 200: - assert response["response"].headers.get("cache-control", None) == "max-age=0" - - -@then(parsers.parse("the response is {response_json}"), converters={"response_json": load_json_file(__file__)}) -def then_response(response, response_json: dict): - """Check entire response""" - if response_json is not None: - # it's very useful having this code hang around: - # import json - # from app.tests import get_complete_filename - # actual = response['response'].json() - # actual_filename = get_complete_filename(__file__, 'actual.json') - # with open(actual_filename, 'w', encoding="utf-8") as file_pointer: - # json.dump(actual, file_pointer, indent=2) - assert response["response"].json() == response_json diff --git a/api/poetry.lock b/api/poetry.lock index 3cf0189a6..1133387f4 100644 --- a/api/poetry.lock +++ b/api/poetry.lock @@ -1336,16 +1336,6 @@ shapely = ">=2.0.0" all = ["GeoAlchemy2", "SQLAlchemy (>=1.3)", "folium", "geopy", "mapclassify", "matplotlib (>=3.5.0)", "psycopg-binary (>=3.1.0)", "pyarrow (>=8.0.0)", "xyzservices"] dev = ["black", "codecov", "pre-commit", "pytest (>=3.1.0)", "pytest-cov", "pytest-xdist"] -[[package]] -name = "glob2" -version = "0.7" -description = "Version of the glob module that can capture patterns and supports recursive wildcards" -optional = false -python-versions = "*" -files = [ - {file = "glob2-0.7.tar.gz", hash = "sha256:85c3dbd07c8aa26d63d7aacee34fa86e9a91a3873bc30bf62ec46e531f92ab8c"}, -] - [[package]] name = "greenlet" version = "3.1.1" @@ -2960,37 +2950,6 @@ files = [ {file = "pandocfilters-1.5.1.tar.gz", hash = "sha256:002b4a555ee4ebc03f8b66307e287fa492e4a77b4ea14d3f934328297bb4939e"}, ] -[[package]] -name = "parse" -version = "1.20.2" -description = "parse() is the opposite of format()" -optional = false -python-versions = "*" -files = [ - {file = "parse-1.20.2-py2.py3-none-any.whl", hash = "sha256:967095588cb802add9177d0c0b6133b5ba33b1ea9007ca800e526f42a85af558"}, - {file = "parse-1.20.2.tar.gz", hash = "sha256:b41d604d16503c79d81af5165155c0b20f6c8d6c559efa66b4b695c3e5a0a0ce"}, -] - -[[package]] -name = "parse-type" -version = "0.6.3" -description = "Simplifies to build parse types based on the parse module" -optional = false -python-versions = "!=3.0.*,!=3.1.*,>=2.7" -files = [ - {file = "parse_type-0.6.3-py2.py3-none-any.whl", hash = "sha256:8d94a52e0197fbad63fee8f70df16e6ed689e5e4f105b705c9afa7a30397a5aa"}, - {file = "parse_type-0.6.3.tar.gz", hash = "sha256:8e99d2f52fab2f0f1f3d68ba9d026060140bf0e53680aada0111fb27b2f0e93a"}, -] - -[package.dependencies] -parse = {version = ">=1.18.0", markers = "python_version >= \"3.0\""} -six = ">=1.15" - -[package.extras] -develop = ["build (>=0.5.1)", "coverage (>=4.4)", "pylint", "pytest (<5.0)", "pytest (>=5.0)", "pytest-cov", "pytest-html (>=1.19.0)", "ruff", "setuptools", "tox (>=2.8,<4.0)", "twine (>=1.13.0)", "virtualenv (<20.22.0)", "virtualenv (>=20.0.0)"] -docs = ["Sphinx (>=1.6)", "sphinx-bootstrap-theme (>=0.6.0)"] -testing = ["pytest (<5.0)", "pytest (>=5.0)", "pytest-html (>=1.19.0)"] - [[package]] name = "parso" version = "0.8.4" @@ -3374,17 +3333,6 @@ files = [ [package.extras] tests = ["pytest"] -[[package]] -name = "py" -version = "1.11.0" -description = "library with cross-python path, ini-parsing, io, code, log facilities" -optional = false -python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" -files = [ - {file = "py-1.11.0-py2.py3-none-any.whl", hash = "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378"}, - {file = "py-1.11.0.tar.gz", hash = "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719"}, -] - [[package]] name = "pycares" version = "4.4.0" @@ -3834,25 +3782,6 @@ pluggy = ">=0.12,<2.0" [package.extras] testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] -[[package]] -name = "pytest-bdd" -version = "5.0.0" -description = "BDD for pytest" -optional = false -python-versions = ">=3.6" -files = [ - {file = "pytest-bdd-5.0.0.tar.gz", hash = "sha256:fab7093ed3d5e51ee0c68de093c90e4f40de345bd9a54a188b2991ce2a2a39cf"}, - {file = "pytest_bdd-5.0.0-py3-none-any.whl", hash = "sha256:c7cf12209606421f61f36b5dc63beccd0c82d29446c0592cf68af2dad0a9761d"}, -] - -[package.dependencies] -glob2 = "*" -Mako = "*" -parse = "*" -parse-type = "*" -py = "*" -pytest = ">=4.3" - [[package]] name = "pytest-cov" version = "6.0.0" @@ -5436,4 +5365,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = ">=3.12.3" -content-hash = "5d293116c8192574399365177425e65ba354e68815bfbeb6776b4a256ca2fed5" +content-hash = "56a5b4a2de2a671277112ad94fed6d98e8cc66bd89d1c29678d83cb9c403e291" diff --git a/api/pyproject.toml b/api/pyproject.toml index 52b3ee999..293a0e369 100644 --- a/api/pyproject.toml +++ b/api/pyproject.toml @@ -52,7 +52,6 @@ shapely = "^2.0.5" pytest = "^7.2.1" jupyter = "^1" notebook = "^7.0.7" -pytest_bdd = "^5" coverage = "^7.6.4" pycodestyle = "^2" autopep8 = "^2"