Stefan-Endres / shgo

Simplicial Homology Global Optimization
https://stefan-endres.github.io/shgo
MIT License
44 stars 12 forks source link

Pytest problems with test classes containing __init__ #13

Closed alchemyst closed 6 years ago

alchemyst commented 6 years ago

Not all tests are running. I receive the following warnings:

shgo/tests/test__shgo.py::TestFunction
  cannot collect test class 'TestFunction' because it has a __init__ constructor

shgo/tests/test__shgo.py::Test1
  cannot collect test class 'Test1' because it has a __init__ constructor

shgo/tests/test__shgo.py::Test2
  cannot collect test class 'Test2' because it has a __init__ constructor

shgo/tests/test__shgo.py::Test3
  cannot collect test class 'Test3' because it has a __init__ constructor

shgo/tests/test__shgo.py::Test4
  cannot collect test class 'Test4' because it has a __init__ constructor

shgo/tests/test__shgo.py::TestLJ
  cannot collect test class 'TestLJ' because it has a __init__ constructor

shgo/tests/test__shgo.py::TestTable
  cannot collect test class 'TestTable' because it has a __init__ constructor

shgo/tests/test__shgo.py::TestInfeasible
  cannot collect test class 'TestInfeasible' because it has a __init__ constructor

-- Docs: http://doc.pytest.org/en/latest/warnings.html
Stefan-Endres commented 6 years ago

These are not tests by themselves, but initiations that run several tests using the same class. I will add decorators to skip these tests.

Stefan-Endres commented 6 years ago

The only decorator I could find @pytest.mark.skip(reason="Not a unittest") still produced warnings and did not solve this issue. From http://pytest.readthedocs.io/en/reorganize-docs/new-docs/user/skipping.html there does not appear to be any simple way to skip the warnings. I will look into alternatives, maybe we could use something from the numpy.testing module.