Skip to content

Add pytest fixture to control optional dependency #26902

Open
@TomAugspurger

Description

@TomAugspurger

When a method depends on an optional dependency, we want to test behavior that relies on it being installed & not installed. Right now, we have to add skips for both cases

  1. Test behavior when installed, skip if not installed
  2. Test behavior when not installed, skip if installed

Ideally, we would always test the second, by simulating a missing dependency. Unfortunately, python's caching of imports makes this somewhat difficult to achieve. Hopefully it doesn't require writing a custom importer: https://docs.python.org/3/library/importlib.html#introduction

Metadata

Metadata

Assignees

No one assigned

    Labels

    DependenciesRequired and optional dependenciesEnhancementTestingpandas 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