Skip to content

The instance of WorkspaceClient created by the ws fixture is not shared across test functions #284

Description

@benberryallwood

The documentation for the ws fixture says:

This fixture initializes a Databricks WorkspaceClient object, which can be used to interact with the Databricks workspace API. The created instance of WorkspaceClient is shared across all test functions within the test session.

This is not true. The fixture uses the default "function" scope, see the pytest documentation:

function: the default scope, the fixture is destroyed at the end of the test.

This can be shown with a simple example:

def test_ws(ws):
    print(id(ws))

def test_ws_2(ws):
    print(id(ws))

When run with pytest --capture=no, we see two different object ids for the two instances created.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions