boutproject / xBOUT

Collects BOUT++ data from parallelized simulations into xarray.
https://xbout.readthedocs.io/en/latest/
Apache License 2.0
22 stars 10 forks source link

Set options in conftest.py instead of pytest.ini, install conftest.py #160

Closed johnomotani closed 4 years ago

johnomotani commented 4 years ago

pytest.ini is ignored even if installed when testing the installed package with pytest --pyargs xbout. To get around this, set all options in conftest.py, and move conftest.py to the xbout/ directory so that it gets installed with the package.

Note, putting conftest.py in the xbout/ directory so that it is used both by tests/* and calc/tests/*.

pep8speaks commented 4 years ago

Hello @johnomotani! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! :beers:

Comment last updated at 2020-10-06 18:28:16 UTC
codecov-commenter commented 4 years ago

Codecov Report

Merging #160 into master will increase coverage by 0.00%. The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #160   +/-   ##
=======================================
  Coverage   76.89%   76.89%           
=======================================
  Files          11       12    +1     
  Lines        1913     1939   +26     
  Branches      431      437    +6     
=======================================
+ Hits         1471     1491   +20     
- Misses        291      296    +5     
- Partials      151      152    +1     
Impacted Files Coverage Δ
conftest.py 76.92% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3b20d69...dc41fee. Read the comment docs.

johnomotani commented 4 years ago

I think this PR is an improvement, but I'd be glad to know of a neater way to do it... The problem it's trying to solve is to get pytest configuration set up in a way that works both: (1) after cloning the git repo, running pytest from either the top level, or in the xbout directory, etc; and (2) when xbout is installed as a package, running pytest --pyargs xbout.

The problems:

The solutions:

So in summary, this solution seems to work. I think it's ugly, and I'd welcome a nicer way, but I think it's better to have some solution that makes --long work both in a cloned xbout git repo and for xbout installed as a package.

PS the original motivation for this is that the long marker was not being recognised by the conda-forge set up, so that was running the long version of the tests (which seems like an anti-social thing to do when they take ~30 mins to run, and the package was already tested by the Github action before being released).

johnomotani commented 4 years ago

I want to get xbout released on conda, so I'm going to merge this now. If anyone has nicer ideas, we can rework in another PR.