4 ms·
Some time ago I wrote a pytest plugin[1] that helps me test my long running shell scripts. The idea was to treat the shell process as a fixture, and conditions
by bow_ 8y ago
Some time ago I wrote a pytest plugin[1] that helps me test my long running shell scripts.
The idea was to treat the shell process as a fixture, and conditions before and after the test (input file checksums, output files, generated stdout/stderr, etc.) would be checked. It was mostly for data analysis pipelines (hence the name).
I don't use it as much these days as my days of writing long running pipelines are behind me. But for that time, it did its job pretty ok. It was also a nice way to peek into pytest's internals.
[1] https://github.com/bow/pytest-pipeline https://github.com/bow/pytest-pipeline
- SonicSoul 8y agoInteresting! If you were doing this today, would you still use your tool or are there other better ways to test?
- bow_ 8y agoIt depends. Another commenter mentioned Cram, which I would look into if checking stdout/stderr (mostly) is enough for my use case. If I am already using a specific framework to write the pipelines, I would also look into whether it already provides ways for testing. I am not aware of other tools that test for pre-/post- conditions, so I would probably start with mine and see if need to tweak things along the way. One thing I am not too happy about the plugin is that sometimes setting up the process as a fixture can be quite verbose. It feels like this part can be improved with some more thought.