Skip to content

teardown code of package scope fixture should be executed right after last test in that directory #7416

Description

@jcyrss
  • description

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

image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: fixturesanything involving fixtures directly or indirectly

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions