You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ptw currently has --onexit, but no --onstart - There should be no reason for this asymmetrical design. There is already --beforerun, but it is run before every run of pytest and so, isn't a good candidate for initialising something just once.
It can be useful for starting things like a external notifier, which wants to run for the whole duration of ptw.
Adding it should be trivial.
The text was updated successfully, but these errors were encountered:
bendtherules
changed the title
Add --onstart similar to --onexit
Add --onstart similar to --onexit
Dec 3, 2015
Unlike the --onexit option, there isn't a strong case for its dual aside from the purity of symmetry.
--onstart can be accomplished outside of ptw pretty easily (such as myscript && ptw). However, --onexit solves a practical problem where you need to run some explicit cleanup code before terminating from an external script environment, e.g. a Makefile or npm run. (In retrospect, --finally may be a better name than --onexit to match the common try-finally concept. This name might better indicate that there isn't some "missing" dual feature.)
Symmetry is a nice property to have in theory and mathematics, but it can easily lead to over-engineering and clutter if there's no other purpose. Adding a feature is usually much easier than maintaining it, so triviality isn't exactly a good indicator of necessity.
ptw currently has
--onexit
, but no--onstart
- There should be no reason for this asymmetrical design. There is already--beforerun
, but it is run before every run of pytest and so, isn't a good candidate for initialising something just once.It can be useful for starting things like a external notifier, which wants to run for the whole duration of ptw.
Adding it should be trivial.
The text was updated successfully, but these errors were encountered: