Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix %reload_kedro line magic #3231

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions kedro/ipython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def _resolve_project_path(
else:
if local_namespace and "context" in local_namespace:
# noqa: protected-access
project_path = local_namespace["context"]._project_path
project_path = local_namespace["context"].project_path
else:
project_path = _find_kedro_project(Path.cwd())
if project_path:
Expand All @@ -147,7 +147,7 @@ def _resolve_project_path(
project_path
and local_namespace
and "context" in local_namespace
and project_path != local_namespace["context"]._project_path
and project_path != local_namespace["context"].project_path
):
logger.info("Updating path to Kedro project: %s...", project_path)

Expand Down
4 changes: 2 additions & 2 deletions tests/ipython/test_ipython.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def test_only_path_specified(self):
def test_only_local_namespace_specified(self):
class MockKedroContext:
# A dummy stand-in for KedroContext sufficient for this test
_project_path = Path("/test").resolve()
project_path = Path("/test").resolve()

result = _resolve_project_path(local_namespace={"context": MockKedroContext()})
expected = Path("/test").resolve()
Expand Down Expand Up @@ -280,7 +280,7 @@ def test_project_path_unresolvable_warning(self, mocker, caplog, ipython):
def test_project_path_update(self, caplog):
class MockKedroContext:
# A dummy stand-in for KedroContext sufficient for this test
_project_path = Path("/test").resolve()
project_path = Path("/test").resolve()

local_namespace = {"context": MockKedroContext()}
updated_path = Path("/updated_path").resolve()
Expand Down