[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

How to run unit tests?



Dear Python experts,

in trying to update the python-lark package [0] to the most recent upstream version, an interesting issue regarding unit tests showed up [1]. Depending on how one runs unit tests they either fail or not. Tried options are:

1. PYTHONWARNINGS=d pythonX -m unittest discover -v tests
2. pythonX setup.py test
3. pythonX -m tests

Upstream uses option 3 in its CI testing [2] and did not see any issues with lark release 0.11.1. dh_auto_test seems to use option 2 by default (for the pybuild build system). For autopkgtest I have chosen to use option 1. The latter two options both fail for version 0.11.1. After applying a patch provided by upstream [3], also option 2 works but option 1 still fails. Upstream suggested to change the way the (autopkgtest) tests are run [4].

I am reluctant to do this without a better understanding of the differences between the above three options. Can anybody shed some light on the differences between them? Is there something like a general recommendation on what is the best way to run Python unit tests?

Peter

[0] https://salsa.debian.org/python-team/packages/python-lark
[1] https://github.com/lark-parser/lark/issues/792
[2] https://github.com/lark-parser/lark/blob/0.11.1/.github/workflows/tests.yml#L28
[3] https://github.com/lark-parser/lark/pull/782
[4] https://github.com/lark-parser/lark/issues/792#issuecomment-739504664


Reply to: