Skip to content

TST: Change class-based auto-use setup to fixtures  #21575

Closed
@TomAugspurger

Description

@TomAugspurger

In #19535 we're excluding data test files from the distribution, which required some changes.

The hardest tests to update were the IO ones that read in a bunch of files in setup and set them as attributes on self.

In the PR, I changed these setup / teardown methods to be yield-base autouse yield methods. See https://github.com/pandas-dev/pandas/pull/19535/files#diff-8cfd1704100c1e13de1bac288482b344R41 for an example.

Ideally we would change the tests to accept the file / parsed object as a fixture, rather than accessing it off self.

The hard part is generating fixtures dynamically, e.g. one fixture per CSV in this directory. We can accomplish that with pytest_generate_tests: https://github.com/pandas-dev/pandas/pull/19535/files#diff-3f782eafb799811bd5516f328411418dR31

Metadata

Metadata

Assignees

No one assigned

    Labels

    RefactorInternal refactoring of codeTestingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions