There is a lot of python code in the puppet repo. Naturally, anything that reaches a certain level of complexity needs a more robust language than bash, so we usually turn to python for that. As a result, python testing takes place in puppet's CI tasks, both in flake8 linting (which has its own issues) and unit tests.
We are proposing some changes to the unit test setup. Right now, to set up unit tests, one must edit the ruby taskgen file for Rake to consume, update the universal tox.ini with an environment and go from there. If we only separated such things into modules, that would be sufficient. However, we separate projects/items into profiles as well. Additionally, individuals are discouraged from adding tests when a lot of complexity is present that impacts everyone rather than just their work.
Changes proposed:
- Edit taskgen to support finding tox.ini files in each module instead of a single universal one with conditional changes filters. This is an idea right now, we still need to produce a patch.
- Create an appropriate tox.ini file for each module already using tests.
- On profiles, filter for a tox.ini at modules/profile/files/*/tox.ini
- Encourage a standard of placing python scripts and their tests in puppet inside a package directory (in the python sense) to facilitate testing and locating of python. This also allows environments to be defined for test suites in tox.