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
if we define a fixture with package scope, and the fixture function registers a finalizer, we will see finalizer teardown code executing not directly after the last test in that directory.
I think ensure it executing right after the last test in that directory is important, because if not so, the data created during setup in this directory may ruin tests in other directory
:param scope: The scope for which this fixture is shared; one of ``"function"`` (default), ``"class"``, ``"module"``, ``"package"`` or ``"session"``.
package 的意思是 session,整个session结束后执行,并不是当前module结束时运行,没有这个BUG,大家可以散了。
Package means session. It is executed after the end of the whole session. It is not run at the end of the current module. Without this bug, you can break up.
Unfortunately that's how things are implemented now, but there are plans to change how fixtures are finalized in #4871. Closing this for now as a duplicate.
if we define a fixture with
package
scope, and the fixture function registers a finalizer, we will see finalizer teardown code executing not directly after the last test in that directory.I think ensure it executing right after the last test in that directory is important, because if not so, the data created during setup in this directory may ruin tests in other directory
OS Version
Windows 10
pytest version
pytest-5.4.3
example
download the following, unzip and run
cases.zip
you will see the output like the following, in which teardown of login directory should be right after last test in that directory
The text was updated successfully, but these errors were encountered: