Compare commits

...

1 Commits

Author SHA1 Message Date
claude[bot] f69c08e832 test: Add integration test to reproduce issue #397
Add test_remove_default_project_issue_397 that reproduces the bug
where a removed project still appears in 'bm project list'.

The test:
- Adds a new project and sets it as default
- Removes the original default project
- Verifies the removed project no longer appears in the list

This test will fail while the bug exists, confirming the issue.

Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>
2025-10-23 13:09:16 +00:00
@@ -119,3 +119,52 @@ def test_project_set_default(app_config, config_manager):
for line in lines:
if "another-project" in line:
assert "" in line
def test_remove_default_project_issue_397(app_config, config_manager):
"""Test that removed default project doesn't appear in list (issue #397).
Reproduces bug where 'main' project still shows in 'bm project list'
after being removed.
"""
runner = CliRunner()
# Use a separate temporary directory to avoid nested path conflicts
with tempfile.TemporaryDirectory() as temp_dir:
new_project_path = Path(temp_dir) / "newmain"
new_project_path.mkdir()
# Step 1: Add a new project
result = runner.invoke(app, ["project", "add", "newmain", str(new_project_path)])
if result.exit_code != 0:
print(f"STDOUT: {result.stdout}")
print(f"STDERR: {result.stderr}")
assert result.exit_code == 0
# Step 2: Set the new project as default
result = runner.invoke(app, ["project", "default", "newmain"])
if result.exit_code != 0:
print(f"STDOUT: {result.stdout}")
print(f"STDERR: {result.stderr}")
assert result.exit_code == 0
# Step 3: Remove the original default project (test-project acts as "main")
result = runner.invoke(app, ["project", "remove", "test-project"])
if result.exit_code != 0:
print(f"STDOUT: {result.stdout}")
print(f"STDERR: {result.stderr}")
assert result.exit_code == 0
# Step 4: Verify test-project is NOT in the list
result = runner.invoke(app, ["project", "list"])
if result.exit_code != 0:
print(f"STDOUT: {result.stdout}")
print(f"STDERR: {result.stderr}")
assert result.exit_code == 0
# Bug: test-project still appears in list after removal
# Expected: test-project should NOT be in the output
assert "test-project" not in result.stdout, (
f"Bug reproduced: 'test-project' still appears in list after removal.\n"
f"Output:\n{result.stdout}"
)