From c07c575730cb0d15872c660787245724e475d8da Mon Sep 17 00:00:00 2001 From: Theodore Chang <theodore.chang@physik.hu-berlin.de> Date: Wed, 19 Mar 2025 14:28:51 +0000 Subject: [PATCH] Update dependencies: pytest --- .gitlab-ci.yml | 2 +- Dockerfile | 1 - pyproject.toml | 14 +++++++++----- pytest.ini | 5 ----- requirements-dev.txt | 20 ++++++++++---------- requirements-plugins.txt | 4 ++-- requirements.txt | 10 +++++----- tests/app/v1/conftest.py | 2 +- tests/conftest.py | 4 ++-- tests/test_client.py | 2 +- 10 files changed, 31 insertions(+), 33 deletions(-) delete mode 100644 pytest.ini diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5fdf953a3b..7110cc6567 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -193,7 +193,7 @@ generate pytest timings: - <<: [*non-docs-changes, *manual-allow_failure] python tests: - parallel: 3 + parallel: 4 extends: .base_test script: - python -m pytest --cov=nomad --cov-report term --cov-config=.coveragerc -sv tests --splits $CI_NODE_TOTAL --group=$CI_NODE_INDEX diff --git a/Dockerfile b/Dockerfile index 8b6add58be..4cdea3916d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -138,7 +138,6 @@ COPY .coveragerc \ MANIFEST.in \ mkdocs.yml \ pyproject.toml \ - pytest.ini \ README.md \ README.parsers.md \ requirements.txt \ diff --git a/pyproject.toml b/pyproject.toml index 127747787c..aab752e1c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,7 +96,7 @@ dev = [ 'pytest-split', 'pytest-timeout', 'pytest-xdist', - 'pytest>=5.3,<8', + 'pytest', 'python-gitlab', 'ruff', 'setuptools>=70', # py3.12 doesn't bundle in setuptools, but this is required by mongomock lib @@ -179,12 +179,16 @@ plugins = ["pydantic.mypy"] extra-index-url = [ "https://gitlab.mpcdf.mpg.de/api/v4/projects/2187/packages/pypi/simple", ] -constraint-dependencies = [# can be removed once pynxtools removes kikuchipy restriction - "hyperspy>=1.7.6", - "pillow<10.1", -] override-dependencies = [ 'elasticsearch-dsl<8', 'python-magic', 'unidecode', ] + +[tool.pytest.ini_options] +asyncio_default_fixture_loop_scope = "function" +testpaths = ["tests"] +filterwarnings = [ + "ignore::DeprecationWarning", + "ignore::SyntaxWarning", +] \ No newline at end of file diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index c0a535889d..0000000000 --- a/pytest.ini +++ /dev/null @@ -1,5 +0,0 @@ -[pytest] -testpaths = - tests -filterwarnings = - ignore::DeprecationWarning \ No newline at end of file diff --git a/requirements-dev.txt b/requirements-dev.txt index 7118a0dfec..5dc8cabb70 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -5,7 +5,7 @@ aiosmtpd==1.4.6 # via nomad-lab (pyproject.toml) alembic==1.15.1 # via jupyterhub, -r requirements.txt amqp==5.3.1 # via kombu, -r requirements.txt annotated-types==0.7.0 # via pydantic, -r requirements.txt -anyio==4.8.0 # via httpx, starlette, watchfiles, -r requirements.txt +anyio==4.9.0 # via httpx, starlette, watchfiles, -r requirements.txt arrow==1.3.0 # via isoduration, -r requirements.txt ase==3.22.1 # via matid, -r requirements.txt, nomad-lab (pyproject.toml) asttokens==2.4.1 # via devtools @@ -30,7 +30,7 @@ click-plugins==1.1.1 # via celery, -r requirements.txt click-repl==0.3.0 # via celery, -r requirements.txt colorama==0.4.6 # via click, mkdocs, mkdocs-material, pytest, tqdm, uvicorn, -r requirements.txt contourpy==1.3.1 # via matplotlib, -r requirements.txt -coverage==7.6.12 # via pytest-cov +coverage==7.7.0 # via pytest-cov cryptography==44.0.2 # via certipy, jwcrypto, pyjwt, rfc3161ng, -r requirements.txt cycler==0.12.1 # via matplotlib, -r requirements.txt deprecation==2.1.0 # via python-keycloak, -r requirements.txt @@ -93,7 +93,7 @@ mkdocs-get-deps==0.2.0 # via mkdocs mkdocs-git-revision-date-localized-plugin==1.4.5 # via nomad-lab (pyproject.toml) mkdocs-glightbox==0.4.0 # via nomad-lab (pyproject.toml) mkdocs-macros-plugin==1.3.7 # via nomad-lab (pyproject.toml) -mkdocs-material==9.6.8 # via nomad-lab (pyproject.toml) +mkdocs-material==9.6.9 # via nomad-lab (pyproject.toml) mkdocs-material-extensions==1.3.1 # via mkdocs-material, nomad-lab (pyproject.toml) mkdocs-redirects==1.2.2 # via nomad-lab (pyproject.toml) mongoengine==0.29.1 # via -r requirements.txt, nomad-lab (pyproject.toml) @@ -108,7 +108,7 @@ networkx==3.4.2 # via matid, pymatgen, -r requirements.txt numpy==1.26.4 # via ase, contourpy, h5grove, h5py, matid, matplotlib, monty, pandas, pymatgen, scikit-learn, scipy, spglib, tifffile, xarray, -r requirements.txt, nomad-lab (pyproject.toml) oauthenticator==17.3.0 # via -r requirements.txt, nomad-lab (pyproject.toml) oauthlib==3.2.2 # via jupyterhub, -r requirements.txt -optimade==1.2.1 # via -r requirements.txt, nomad-lab (pyproject.toml) +optimade==1.2.2 # via -r requirements.txt, nomad-lab (pyproject.toml) orjson==3.10.15 # via h5grove, -r requirements.txt, nomad-lab (pyproject.toml) packaging==24.2 # via deprecation, gunicorn, jupyter-events, jupyterhub, matplotlib, mkdocs, mkdocs-macros-plugin, mongomock, pint, plotly, pytest, xarray, -r requirements.txt paginate==0.5.7 # via mkdocs-material @@ -116,7 +116,7 @@ palettable==3.3.3 # via pymatgen, -r requirements.txt pamela==1.2.0 ; sys_platform != 'win32' # via jupyterhub, -r requirements.txt pandas==2.2.3 # via pymatgen, xarray, -r requirements.txt, nomad-lab (pyproject.toml) pathspec==0.12.1 # via mkdocs, mkdocs-macros-plugin -pillow==10.0.1 # via matplotlib, -c (workspace), -r requirements.txt +pillow==11.1.0 # via matplotlib, -r requirements.txt pint==0.17 # via -r requirements.txt, nomad-lab (pyproject.toml) platformdirs==4.3.6 # via mkdocs-get-deps plotly==5.24.1 # via pymatgen, -r requirements.txt, nomad-lab (pyproject.toml) @@ -138,10 +138,10 @@ pyinstrument==5.0.1 # via -r requirements.txt, nomad-lab (pyproject.toml) pyjwt==2.10.1 # via oauthenticator, -r requirements.txt, nomad-lab (pyproject.toml) pymatgen==2024.5.1 # via -r requirements.txt, nomad-lab (pyproject.toml) pymdown-extensions==10.14.3 # via mkdocs-material -pymongo==4.11.2 # via mongoengine, optimade, -r requirements.txt +pymongo==4.11.3 # via mongoengine, optimade, -r requirements.txt pyparsing==3.2.1 # via matplotlib, rdflib, -r requirements.txt -pytest==7.4.4 # via pytest-asyncio, pytest-cov, pytest-split, pytest-timeout, pytest-xdist, nomad-lab (pyproject.toml) -pytest-asyncio==0.23.8 # via nomad-lab (pyproject.toml) +pytest==8.3.5 # via pytest-asyncio, pytest-cov, pytest-split, pytest-timeout, pytest-xdist, nomad-lab (pyproject.toml) +pytest-asyncio==0.25.3 # via nomad-lab (pyproject.toml) pytest-cov==6.0.0 # via nomad-lab (pyproject.toml) pytest-split==0.10.0 # via nomad-lab (pyproject.toml) pytest-timeout==2.3.1 # via nomad-lab (pyproject.toml) @@ -156,7 +156,7 @@ python-magic==0.4.27 # via --override (workspace), -r requirements.txt, nom python-magic-bin==0.4.14 ; sys_platform == 'win32' # via -r requirements.txt, nomad-lab (pyproject.toml) python-multipart==0.0.20 # via -r requirements.txt, nomad-lab (pyproject.toml) pytz==2025.1 # via mkdocs-git-revision-date-localized-plugin, mongomock, pandas, -r requirements.txt, nomad-lab (pyproject.toml) -pywin32==309 ; sys_platform == 'win32' # via docker, -r requirements.txt +pywin32==310 ; sys_platform == 'win32' # via docker, -r requirements.txt pyyaml==6.0.2 # via jupyter-events, mkdocs, mkdocs-get-deps, mkdocs-macros-plugin, pybtex, pymdown-extensions, pyyaml-env-tag, uvicorn, -r requirements.txt, nomad-lab (pyproject.toml) pyyaml-env-tag==0.1 # via mkdocs rdflib==5.0.0 # via -r requirements.txt, nomad-lab (pyproject.toml) @@ -173,7 +173,7 @@ ruff==0.11.0 # via nomad-lab (pyproject.toml) scikit-learn==1.6.1 # via matid, -r requirements.txt scipy==1.15.2 # via ase, pymatgen, scikit-learn, -r requirements.txt, nomad-lab (pyproject.toml) sentinels==1.0.0 # via mongomock, -r requirements.txt -setuptools==76.0.0 # via nomad-lab (pyproject.toml) +setuptools==76.1.0 # via nomad-lab (pyproject.toml) six==1.17.0 # via asttokens, elasticsearch-dsl, pybtex, python-dateutil, rdflib, rfc3339-validator, -r requirements.txt smmap==5.0.2 # via gitdb sniffio==1.3.1 # via anyio, httpx, -r requirements.txt diff --git a/requirements-plugins.txt b/requirements-plugins.txt index 600a2dc394..63224413e5 100644 --- a/requirements-plugins.txt +++ b/requirements-plugins.txt @@ -3,7 +3,7 @@ aiofiles==24.1.0 # via python-keycloak, -c requirements-dev.txt aniso8601==10.0.0 # via nomad-lab annotated-types==0.7.0 # via pydantic, -c requirements-dev.txt -anyio==4.8.0 # via httpx, -c requirements-dev.txt +anyio==4.9.0 # via httpx, -c requirements-dev.txt ase==3.22.1 # via asr, matid, nomad-lab, -c requirements-dev.txt asr==0.4.1 # via nomad-parser-plugins-workflow async-property==0.2.2 # via python-keycloak, -c requirements-dev.txt @@ -85,7 +85,7 @@ panedr==0.8.0 # via nomad-lab, nomad-parser-plugins-atomistic parmed==4.3.0 # via nomad-lab pathsimanalysis==1.2.0 # via mdanalysis phonopy==2.11.0 # via asr, nomad-parser-plugins-workflow -pillow==10.0.1 # via matplotlib, -c requirements-dev.txt, -c (workspace) +pillow==11.1.0 # via matplotlib, -c requirements-dev.txt pint==0.17 # via nomad-lab, -c requirements-dev.txt plotly==5.24.1 # via asr, nomad-lab, pymatgen, -c requirements-dev.txt py-spy==0.4.0 # via nomad-lab, -c requirements-dev.txt diff --git a/requirements.txt b/requirements.txt index 33eacb4090..e4eed40e73 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,7 +4,7 @@ aiofiles==24.1.0 # via python-keycloak alembic==1.15.1 # via jupyterhub amqp==5.3.1 # via kombu annotated-types==0.7.0 # via pydantic -anyio==4.8.0 # via httpx, starlette, watchfiles +anyio==4.9.0 # via httpx, starlette, watchfiles arrow==1.3.0 # via isoduration ase==3.22.1 # via matid, nomad-lab (pyproject.toml) async-property==0.2.2 # via python-keycloak @@ -80,13 +80,13 @@ networkx==3.4.2 # via matid, pymatgen numpy==1.26.4 # via ase, contourpy, h5grove, h5py, matid, matplotlib, monty, pandas, pymatgen, scikit-learn, scipy, spglib, tifffile, xarray, nomad-lab (pyproject.toml) oauthenticator==17.3.0 # via nomad-lab (pyproject.toml) oauthlib==3.2.2 # via jupyterhub -optimade==1.2.1 # via nomad-lab (pyproject.toml) +optimade==1.2.2 # via nomad-lab (pyproject.toml) orjson==3.10.15 # via h5grove, nomad-lab (pyproject.toml) packaging==24.2 # via deprecation, gunicorn, jupyter-events, jupyterhub, matplotlib, mongomock, pint, plotly, xarray palettable==3.3.3 # via pymatgen pamela==1.2.0 ; sys_platform != 'win32' # via jupyterhub pandas==2.2.3 # via pymatgen, xarray, nomad-lab (pyproject.toml) -pillow==10.0.1 # via matplotlib, -c (workspace) +pillow==11.1.0 # via matplotlib pint==0.17 # via nomad-lab (pyproject.toml) plotly==5.24.1 # via pymatgen, nomad-lab (pyproject.toml) ply==3.11 # via jsonpath-ng @@ -104,7 +104,7 @@ pydantic-settings==2.8.1 # via h5grove, optimade pyinstrument==5.0.1 # via nomad-lab (pyproject.toml) pyjwt==2.10.1 # via oauthenticator, nomad-lab (pyproject.toml) pymatgen==2024.5.1 # via nomad-lab (pyproject.toml) -pymongo==4.11.2 # via mongoengine, optimade +pymongo==4.11.3 # via mongoengine, optimade pyparsing==3.2.1 # via matplotlib, rdflib python-dateutil==2.9.0.post0 # via arrow, celery, elasticsearch-dsl, jupyterhub, matplotlib, pandas, rfc3161ng python-dotenv==1.0.1 # via pydantic-settings, uvicorn @@ -115,7 +115,7 @@ python-magic==0.4.27 # via --override (workspace), nomad-lab (pyproject.tom python-magic-bin==0.4.14 ; sys_platform == 'win32' # via nomad-lab (pyproject.toml) python-multipart==0.0.20 # via nomad-lab (pyproject.toml) pytz==2025.1 # via mongomock, pandas, nomad-lab (pyproject.toml) -pywin32==309 ; sys_platform == 'win32' # via docker +pywin32==310 ; sys_platform == 'win32' # via docker pyyaml==6.0.2 # via jupyter-events, pybtex, uvicorn, nomad-lab (pyproject.toml) rdflib==5.0.0 # via nomad-lab (pyproject.toml) referencing==0.36.2 # via jsonschema, jsonschema-specifications, jupyter-events diff --git a/tests/app/v1/conftest.py b/tests/app/v1/conftest.py index d4a1e15fc4..fdbeafb6ae 100644 --- a/tests/app/v1/conftest.py +++ b/tests/app/v1/conftest.py @@ -19,6 +19,6 @@ import pytest -@pytest.fixture(scope='session') +@pytest.fixture(scope='module') def client(api_v1): return api_v1 diff --git a/tests/conftest.py b/tests/conftest.py index a72d3e2687..9b3d5985c3 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -220,7 +220,7 @@ def reset_config(): utils.set_console_log_level(test_log_level) -@pytest.fixture(scope='session') +@pytest.fixture(scope='module') def api_v1(monkeysession, user_molds): """ This fixture provides an HTTP client with Python requests interface that accesses @@ -262,7 +262,7 @@ def api_v1(monkeysession, user_molds): return test_client -@pytest.fixture(scope='session') +@pytest.fixture(scope='module') def client_with_api_v1(api_v1, monkeysession): def call_requests(method, path, *args, **kwargs): return getattr(api_v1, method)(path, *args, **kwargs) diff --git a/tests/test_client.py b/tests/test_client.py index 35211bf701..7cc68cf1c3 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -69,7 +69,7 @@ def many_uploads(non_empty_uploaded: tuple[str, str], user1: User, proc_infra): pass -@pytest.fixture(scope='session') +@pytest.fixture(scope='module') def async_api_v1(monkeysession): """ This fixture provides an HTTP client with AsyncClient that accesses -- GitLab