File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -156,3 +156,20 @@ Another good approach is by adding the data files in the ``tests`` folder.
156
156
There are also community plugins available to help to manage this aspect of
157
157
testing, e.g. `pytest-datadir <https://pypi.org/project/pytest-datadir/ >`__
158
158
and `pytest-datafiles <https://pypi.org/project/pytest-datafiles/ >`__.
159
+
160
+ .. _fixtures-signal-cleanup :
161
+
162
+ A note about fixture cleanup
163
+ ----------------------------
164
+
165
+ pytest does not do any special processing for :data: `SIGTERM <signal.SIGTERM> ` and
166
+ :data: `SIGQUIT <signal.SIGQUIT> ` signals (:data: `SIGINT <signal.SIGINT> ` is handled naturally
167
+ by the Python runtime via :class: `KeyboardInterrupt `), so fixtures that manage external resources which are important
168
+ to be cleared when the Python process is terminated (by those signals) might leak resources.
169
+
170
+ The reason pytest does not handle those signals to perform fixture cleanup is that signal handlers are global,
171
+ and changing them might interfere with the code under execution.
172
+
173
+ If fixtures in your suite need special care regarding termination in those scenarios,
174
+ see `this comment <https://github.com/pytest-dev/pytest/issues/5243#issuecomment-491522595 >`__ in the issue
175
+ tracker for a possible workaround.
You can’t perform that action at this time.
0 commit comments