NNPDF / nnpdf

An open-source machine learning framework for global analyses of parton distributions.
https://docs.nnpdf.science/
GNU General Public License v3.0
28 stars 6 forks source link

Building sphinx docs runs tests #811

Open siranipour opened 4 years ago

siranipour commented 4 years ago

I noticed that when we make html the docs, sphinx interprets the CI tests. This is fine, since mostly they are just function definition, but sometimes there are unguarded global lines e.g:

https://github.com/NNPDF/nnpdf/blob/67c86db33cd279348edbac72f6e0df19f4cfbcca/validphys2/src/validphys/tests/test_calcutils.py#L9

Now this is not much overhead, but the trouble is the pseudodata tests take a non negligible time to to initialize. I shall fix this particular one in #746, but it's something we should probably know about.

Note the following: https://docs.pytest.org/en/stable/fixture.html

Zaharid commented 4 years ago

I think having things that take time to initialize at import time is in general a bad idea, and so fixtures should definitively be used in that case. Other than that, if we can find a way to tell sphinx to ignore the tests so much the better.