Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce tox for testing #197

Merged
merged 21 commits into from
Mar 13, 2025
Merged

Introduce tox for testing #197

merged 21 commits into from
Mar 13, 2025

Conversation

giuliatum
Copy link
Contributor

Closes #177

@giuliatum giuliatum marked this pull request as ready for review March 11, 2025 11:42
setup.py Outdated
@@ -16,6 +16,6 @@
author_email='info@precice.org',
license='LGPL-3.0',
packages=['fenicsprecice'],
install_requires=['pyprecice>=3.0.0.0', 'scipy<1.15.0', 'numpy>=1.13.3, <2', 'mpi4py<4'],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have to revert this before merging but ok during development to avoid having to install preCICE on the system.

@BenjaminRodenberg BenjaminRodenberg added this to the v2.3.0 milestone Mar 12, 2025
Copy link
Member

@BenjaminRodenberg BenjaminRodenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is a minor thing left. But besides that everything works very well and is a super useful (and extremely overdue) update for this repository. Thank you very much :)

Where I'm still struggling:

If I run the following command:

tox -e unit -- tests/test_write_read.py::TestWriteandReadData::test_vector_write

I get the following output:

unit: commands[0]> pytest tests/unit
==================================================================================================================== test session starts =====================================================================================================================
platform linux -- Python 3.12.3, pytest-8.3.5, pluggy-1.5.0
cachedir: .tox/unit/.pytest_cache
rootdir: /home/benjamin/Programming/fenics-adapter
configfile: pyproject.toml
collected 5 items                                                                                                                                                                                                                                            

tests/unit/test_adapter_core.py ..                                                                                                                                                                                                                     [ 40%]
tests/unit/test_checkpointing.py ...                                                                                                                                                                                                                   [100%]

====================================================================================================================== warnings summary ======================================================================================================================
../../../../usr/lib/python3/dist-packages/dijitso/__init__.py:19
  /usr/lib/python3/dist-packages/dijitso/__init__.py:19: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
    from pkg_resources import get_distribution

../../../../usr/lib/python3/dist-packages/pkg_resources/__init__.py:2871
  /usr/lib/python3/dist-packages/pkg_resources/__init__.py:2871: DeprecationWarning: Deprecated call to `pkg_resources.declare_namespace('mpl_toolkits')`.
  Implementing implicit namespace packages (as specified in PEP 420) is preferred to `pkg_resources.declare_namespace`. See https://setuptools.pypa.io/en/latest/references/keywords.html#keyword-namespace-packages
    declare_namespace(pkg)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=============================================================================================================== 5 passed, 2 warnings in 5.09s ================================================================================================================
  unit: OK (5.75=setup[0.07]+cmd[5.68] seconds)
  congratulations :) (5.87 seconds)

This looks to my like all tests in unit are run. However, actually I would like to only see a single test being run. https://stackoverflow.com/a/49935307 gives already a hint: You need pytest {posargs} somewhere in the commands. I personally would not start duplicating this in unit and integration. Instead, it would probably make sense to have a third environment (all?) where we run all tests by default and apply the filtering only if given by the user. The command that we run from the command line would look like:

tox -e all -- tests/test_write_read.py::TestWriteandReadData::test_vector_write

Copy link
Member

@BenjaminRodenberg BenjaminRodenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thank you very much and congratulations to your first contribution 🎉

@BenjaminRodenberg BenjaminRodenberg merged commit cf758ab into precice:develop Mar 13, 2025
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use tox for testing
2 participants