Skip to content
Open
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
Empty file removed C:\Users\litecli\litecli_test.db
Empty file.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### Bug Fixes

- Restore Git checkout on Windows by removing an accidentally committed test database.
- Expand `~` in configured log file paths before opening the log.

### Internal
Expand Down
13 changes: 8 additions & 5 deletions tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ def test_initialize_logging_expands_user_log_file(monkeypatch, tmp_path):


@patch("litecli.main.datetime") # Adjust if your module path is different
def test_get_prompt(mock_datetime):
def test_get_prompt(mock_datetime, tmp_path):
# We'll freeze time at 2025-01-20 13:37:42 for comedic effect.
# Because "leet" times call for 13:37!
frozen_time = datetime(2025, 1, 20, 13, 37, 42)
Expand All @@ -314,10 +314,11 @@ def test_get_prompt(mock_datetime):

# Instantiate and connect
lc = LiteCli()
lc.connect("/tmp/litecli_test.db")
database = tmp_path / "litecli_test.db"
lc.connect(str(database))

# 1. Test \d => full path to the DB
assert lc.get_prompt(r"\d") == "/tmp/litecli_test.db"
assert lc.get_prompt(r"\d") == str(database)

# 2. Test \f => basename of the DB
# (because "f" stands for "filename", presumably!)
Expand Down Expand Up @@ -361,8 +362,10 @@ def test_get_prompt(mock_datetime):
assert lc.get_prompt(r"\f") == "(none)"

# 12. Windows path
lc.connect("C:\\Users\\litecli\\litecli_test.db")
assert lc.get_prompt(r"\d") == "C:\\Users\\litecli\\litecli_test.db"
assert lc.sqlexecute is not None
windows_path = r"C:\Users\litecli\litecli_test.db"
with patch.object(lc.sqlexecute, "dbname", windows_path):
assert lc.get_prompt(r"\d") == windows_path


@pytest.mark.parametrize(
Expand Down