pysat icon indicating copy to clipboard operation
pysat copied to clipboard

How to run / add to tests?

Open ChrisJefferson opened this issue 4 years ago • 4 comments

Hi,

Sorry, I don't know a lot about making Python packages.

I wanted to add some tests for some code I was adding, but I wasn't sure how the tests are structured in the package. Should 'tests' made of TestCases? I had a google and found: https://python-packaging.readthedocs.io/en/latest/testing.html , but I don't think that's what's going on.

ChrisJefferson avatar Jul 05 '20 07:07 ChrisJefferson

Thanks for your question! Actually, it's a shame that there are (almost) no tests in PySAT. :) If you want to prepare one, just create a Python file in tests/. Running $ pytest in the root of the project should do the trick, i.e. it will run every test in that directory. (For that, make sure you have the pytest package installed, e.g. from pip.)

alexeyignatiev avatar Jul 05 '20 07:07 alexeyignatiev

I forgot to mention that there is one example test in tests, which you may want to follow.

alexeyignatiev avatar Jul 05 '20 07:07 alexeyignatiev

@alexeyignatiev Is this task still relevant? I can help with more tests, including using Hypothesis. Also I can setup & check whole codebase with Ruff linter.

ghost avatar Dec 08 '23 11:12 ghost

@dulanov, adding proper testing functionality is definitely still relevant. So your contribution here would be more than welcome! 🙂

alexeyignatiev avatar Dec 10 '23 23:12 alexeyignatiev