Skip to content

Commit

Permalink
Unset project as cleanup in empty_data_context
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler-hoffman committed May 9, 2024
1 parent cf42fc0 commit 41b1ebe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def get_project( # noqa: PLR0913
)
return self.__project

def set_project(self, project: AbstractDataContext) -> None:
def set_project(self, project: AbstractDataContext | None) -> None:
self.__project = project

@property
Expand Down
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,7 @@ def mysql_engine(test_backend):
@pytest.fixture(scope="function")
def empty_data_context(
tmp_path,
) -> FileDataContext:
) -> Generator[FileDataContext, None, None]:
project_path = tmp_path / "empty_data_context"
project_path.mkdir()
project_path = str(project_path)
Expand All @@ -733,7 +733,8 @@ def empty_data_context(
os.makedirs(asset_config_path, exist_ok=True) # noqa: PTH103
assert context.list_datasources() == []
project_manager.set_project(context)
return context
yield context
project_manager.set_project(None)


@pytest.fixture(scope="function")
Expand Down

0 comments on commit 41b1ebe

Please sign in to comment.