leforestier/yattag

Out of box pytest support

AMDmi3 opened this issue · 1 comments

pytest won't run yattag tests out of box because of custom naming. To fix that, either:

  • tests should be removed from tests_*.py to test_*.py
  • pytest.ini should be added with the following contents
    [pytest]
    python_files = tests_*.py
    
  • pytest.cfg should be added with the following contents
    [tool:pytest]
    python_files = tests_*.py
    

To run tests in FreeBSD port of yattag I've went the third way and have patched setup.cfg (which is present in the yattag distribution from PyPI) with the following:

--- setup.cfg.orig	2023-01-02 11:51:34 UTC
+++ setup.cfg
@@ -2,3 +2,5 @@
 tag_build = 
 tag_date = 0
 
+[tool:pytest]
+python_files = tests_*.py

i was about to open an issue for the same reason. I think the "unofficial" standard is to call the tests files with a test_ prefix, so my suggestion would be to just do that, which will cause the least amount of changes and get the same end result (pytest able to collect and run the tests automatically) -- thanks!