diff --git a/bin/commands/update.py b/bin/commands/update.py index bc4eb06..c7cf08c 100644 --- a/bin/commands/update.py +++ b/bin/commands/update.py @@ -43,7 +43,9 @@ def update_cmd() -> None: if makefile.is_file(): rc = _run_make_install(root) if rc != 0: - console.print("[yellow]make install failed, trying pip -e…[/yellow]") + console.print( + "[yellow]make install failed, trying pip -e…[/yellow]" + ) rc = _run_pip_editable(root) else: rc = _run_pip_editable(root) diff --git a/tests/test_cli.py b/tests/test_cli.py index d5e2219..db26c1e 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -31,7 +31,10 @@ class TestCliHelp: runner = CliRunner() result = runner.invoke(cli, ["update", "--help"]) assert result.exit_code == 0 - assert "update" in result.output.lower() or "reinstall" in result.output.lower() + assert ( + "update" in result.output.lower() + or "reinstall" in result.output.lower() + ) def test_upgrade_alias_exists(self) -> None: """upgrade should be an alias for update.""" @@ -96,4 +99,3 @@ class TestCliDefaultBehavior: assert result.exit_code == 0 call_args = mock_run.call_args[0][0] assert "--dangerously-skip-permissions" in call_args - diff --git a/tests/test_project_root.py b/tests/test_project_root.py index e85ae17..78e7330 100644 --- a/tests/test_project_root.py +++ b/tests/test_project_root.py @@ -22,11 +22,16 @@ class TestGetMyclaudeProjectRoot: def test_fallback_when_not_in_repo(self) -> None: """When not in a repo, fallback to ~/.myclaude.""" - with patch.dict(os.environ, {}, clear=True): - with patch("pathlib.Path.cwd", side_effect=OSError): - with patch("bin.project_root._pyproject_names_myclaude", return_value=False): - result = get_myclaude_project_root() - assert result == Path.home() / ".myclaude" + with ( + patch.dict(os.environ, {}, clear=True), + patch("pathlib.Path.cwd", side_effect=OSError), + patch( + "bin.project_root._pyproject_names_myclaude", + return_value=False, + ), + ): + result = get_myclaude_project_root() + assert result == Path.home() / ".myclaude" class TestGetWorkspaceRoot: @@ -59,22 +64,24 @@ class TestGetWorkspaceRoot: workspace.mkdir() (project_root / "pyproject.toml").write_text('name = "myclaude"\n') - with patch.dict(os.environ, {"MYCLAUDE_PROJECT_ROOT": str(project_root)}, clear=True): + with patch.dict( + os.environ, {"MYCLAUDE_PROJECT_ROOT": str(project_root)}, clear=True + ): result = get_workspace_root() assert result == workspace.resolve() def test_defaults_to_home_workspace(self, tmp_path: Path) -> None: """When no env var and no project workspace, default to ~/workspace.""" + home = tmp_path / "home" + home.mkdir() with ( patch.dict(os.environ, {}, clear=True), - patch("bin.project_root.get_myclaude_project_root", return_value=tmp_path / ".myclaude"), - patch.dict(os.environ, {}, clear=True), + patch( + "bin.project_root.get_myclaude_project_root", + return_value=tmp_path / ".myclaude", + ), + patch("pathlib.Path.home", return_value=home), ): - with patch.dict(os.environ, {}, clear=True): - # Ensure HOME is set for Path.home() - home = tmp_path / "home" - home.mkdir() - with patch("pathlib.Path.home", return_value=home): - result = get_workspace_root() - assert result == home / "workspace" - assert result.is_dir() + result = get_workspace_root() + assert result == home / "workspace" + assert result.is_dir()