Spaces:
Sleeping
Sleeping
Claude commited on
fix(test): fermer connexion SQLite avant os.unlink sur Windows
Browse filestest_history_empty_db : gc.collect() force la fermeture des connexions
SQLite résiduelles avant os.unlink, qui échoue sur Windows si le fichier
est encore verrouillé. L'unlink est aussi enveloppé dans try/except OSError
pour éviter que le nettoyage fasse échouer le test.
https://claude.ai/code/session_017gXea9mxBQqDTAsSQd7aAq
tests/test_sprint8_escriptorium_gallica.py
CHANGED
|
@@ -556,7 +556,7 @@ class TestCLIHistory:
|
|
| 556 |
def test_history_empty_db(self):
|
| 557 |
from click.testing import CliRunner
|
| 558 |
from picarones.cli import cli
|
| 559 |
-
import tempfile, os
|
| 560 |
runner = CliRunner()
|
| 561 |
with tempfile.NamedTemporaryFile(suffix=".db", delete=False) as f:
|
| 562 |
db_path = f.name
|
|
@@ -565,7 +565,11 @@ class TestCLIHistory:
|
|
| 565 |
assert result.exit_code == 0
|
| 566 |
assert "Aucun" in result.output or "Aucun benchmark" in result.output
|
| 567 |
finally:
|
| 568 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 569 |
|
| 570 |
def test_history_with_regression_flag(self):
|
| 571 |
from click.testing import CliRunner
|
|
|
|
| 556 |
def test_history_empty_db(self):
|
| 557 |
from click.testing import CliRunner
|
| 558 |
from picarones.cli import cli
|
| 559 |
+
import gc, tempfile, os
|
| 560 |
runner = CliRunner()
|
| 561 |
with tempfile.NamedTemporaryFile(suffix=".db", delete=False) as f:
|
| 562 |
db_path = f.name
|
|
|
|
| 565 |
assert result.exit_code == 0
|
| 566 |
assert "Aucun" in result.output or "Aucun benchmark" in result.output
|
| 567 |
finally:
|
| 568 |
+
gc.collect() # force SQLite connections to close before unlink (Windows)
|
| 569 |
+
try:
|
| 570 |
+
os.unlink(db_path)
|
| 571 |
+
except OSError:
|
| 572 |
+
pass
|
| 573 |
|
| 574 |
def test_history_with_regression_flag(self):
|
| 575 |
from click.testing import CliRunner
|