tardis-sn / tardis

TARDIS - Temperature And Radiative Diffusion In Supernovae
https://tardis-sn.github.io/tardis
198 stars 403 forks source link

Implement tox #2661

Open KasukabeDefenceForce opened 4 weeks ago

KasukabeDefenceForce commented 4 weeks ago

:pencil: Description

Type: :rocket: feature The PR aims at implementing tox for automated testing across various Python versions and environments.

:pushpin: Resources

Examples, notebooks, and links to useful references.

:vertical_traffic_light: Testing

How did you test these changes?

:ballot_box_with_check: Checklist

Note: If you are not allowed to perform any of these actions, ping (@) a contributor.

KasukabeDefenceForce commented 4 weeks ago

For running tests on all the mentioned environments use the command: tox For running tests on specific environment use the command: tox -e {env}-test

For example: tox -e py38-test

andrewfullard commented 3 weeks ago

You said in Slack that the main benefit is testing against multiple Python versions. With our static environment, I am not sure that applies to TARDIS. What other benefits does tox provide?

KasukabeDefenceForce commented 2 days ago

You said in Slack that the main benefit is testing against multiple Python versions. With our static environment, I am not sure that applies to TARDIS. What other benefits does tox provide?

Some other benefits:

  1. We can simplify the test command. For example, instead of running pytest tardis --tardis-refdata=/Users/abhinav/workspace/code/tardis-main/tardis-refdata --tardis-regression-data=/Users/abhinav/workspace/code/tardis-main/tardis-regression-data we can just run tox.
  2. Tox creates separate virtual environments for each test, preventing dependency conflicts and ensuring consistent test conditions. For example, if a user has installed some extra dependencies locally, it wont affect the test environment.

Resources: https://blog.ionelmc.ro/2015/04/14/tox-tricks-and-patterns/ https://codilime.com/blog/python-tox/ https://christophergs.com/python/2020/04/12/python-tox-why-use-it-and-tutorial/

andrewfullard commented 35 minutes ago

Can tox implement single-command testing for all of the not (continuum or rpacket_tracking), continuum, and rpacket_tracking test cases?