close
Skip to content

Allow custom retainable temporary directories in CLIRunner.isolated_filesystem #395

@DasIch

Description

@DasIch

I would like to propose two changes to CLIRunner.isolated_filesystem, which I believe would significantly improve the experience of debugging tests using it:

  1. Add an argument that allows users to specify the temporary directory.
  2. Add an argument indicating that the temporary directory shouldn't be deleted (if an exception occurs).

The current behavior of isolated_filesystem of creating a random temporary directory without allowing specifying a specific directory or even a (partial) name and deleting it no matter what, makes it impossible to inspect the directory in case of test failures to gather more information. Even if the directory wouldn't be deleted, it's difficult to find.

By allowing the user to define a temporary directory, it's possible to take advantage of mechanisms such as py.test's tmpdir fixture or other systems to separate setup code from the actual test and to make the directory known to the user for inspection.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions