Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion odev/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
# or merged change.
# ------------------------------------------------------------------------------

__version__ = "4.29.3"
__version__ = "4.29.4"

Check notice on line 25 in odev/_version.py

View workflow job for this annotation

GitHub Actions / version-bump

Patch Update
3 changes: 2 additions & 1 deletion odev/common/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ class Config:
Light wrapper around configparser to write and retrieve configuration values saved on disk.
"""

parser: ConfigParser = ConfigParser()
parser: ConfigParser
"""Config parser implementation."""

paths: PathsSection
Expand All @@ -329,6 +329,7 @@ class Config:
"""Configuration for security and secrets encryption."""

def __init__(self, name: str = "odev"):
self.parser: ConfigParser = ConfigParser()
self.name: str = name
"""Name of this config manager, also serves as the name of the file
to save configuration to.
Expand Down
11 changes: 11 additions & 0 deletions odev/common/odev.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,17 @@ def start(self, start_time: float | None = None) -> None:

self.plugins_path.mkdir(parents=True, exist_ok=True)

try:
playground_dir = (self.home_path / "playground").resolve()
resolved_path = self.path.resolve()
if resolved_path == playground_dir or playground_dir in resolved_path.parents:
logger.warning(
f"Odev repository is located inside the playground folder: {resolved_path}. "
"This is not recommended and can cause conflicts."
)
except Exception: # noqa: BLE001, S110
pass

if self._should_update_now():
self.check_release()
self.update()
Expand Down
16 changes: 16 additions & 0 deletions tests/tests/common/test_odev.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,19 @@ def test_16_plugins_dependency_tree_cycle_raises(self):
self.odev._plugins_dependency_tree()
finally:
shutil.rmtree(cycle_root, ignore_errors=True)

def test_17_warning_if_in_playground(self):
"""Odev should display a warning if the repository path is inside the playground directory."""
mock_path = self.odev.home_path / "playground" / "my-odev-repo"
with (
self.patch_property(type(self.odev), "path", mock_path),
self.patch(logger, "warning") as mock_warning,
self.patch(self.odev, "load_plugins"),
self.patch(self.odev, "register_commands"),
self.patch(self.odev, "register_plugin_commands"),
self.patch(self.odev, "prune_databases"),
):
self.odev._started = False
self.odev.start()
mock_warning.assert_called_once()
self.assertIn("located inside the playground folder", mock_warning.call_args[0][0])
Loading