From 350dc6a34d385e3f297e1584fa328ce309c6abb7 Mon Sep 17 00:00:00 2001 From: ranjithkumar200621-arch <235286672+ranjithkumar200621-arch@users.noreply.github.com> Date: Tue, 1 Dec 2026 20:35:13 +0530 Subject: [PATCH] Fix Windows checkout blocked by a test database (#276) --- "C:\\Users\\litecli\\litecli_test.db" | 0 CHANGELOG.md | 1 + tests/test_main.py | 13 ++++++++----- 3 files changed, 9 insertions(+), 5 deletions(-) delete mode 100644 "C:\\Users\\litecli\\litecli_test.db" diff --git "a/C:\\Users\\litecli\\litecli_test.db" "b/C:\\Users\\litecli\\litecli_test.db" deleted file mode 100644 index e69de29..0000000 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d91317..bee822b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/tests/test_main.py b/tests/test_main.py index 21ad5b6..8def5ac 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -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) @@ -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!) @@ -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(