Page MenuHomeSoftware Heritage

D8300.id29976.diff
No OneTemporary

D8300.id29976.diff

diff --git a/.gitignore b/.gitignore
--- a/.gitignore
+++ b/.gitignore
@@ -13,7 +13,7 @@
docs/build/
docs/uri-scheme.md
docs/dev-info.md
-*.sqlite3
+*.sqlite3*
.vscode/
.directory
node_modules/
diff --git a/cypress/plugins/index.js b/cypress/plugins/index.js
--- a/cypress/plugins/index.js
+++ b/cypress/plugins/index.js
@@ -35,7 +35,10 @@
};
function getDatabase() {
- return new sqlite3.Database('./swh-web-test.sqlite3');
+ const db = new sqlite3.Database('./swh-web-test.sqlite3');
+ // to prevent "database is locked" error when running tests
+ db.run('PRAGMA journal_mode = WAL;');
+ return db;
}
module.exports = (on, config) => {
diff --git a/swh/web/settings/tests.py b/swh/web/settings/tests.py
--- a/swh/web/settings/tests.py
+++ b/swh/web/settings/tests.py
@@ -129,6 +129,16 @@
settings.DATABASES["default"].update(
{"ENGINE": "django.db.backends.sqlite3", "NAME": "swh-web-test.sqlite3"}
)
+
+ # to prevent "database is locked" error when running cypress tests
+ from django.db.backends.signals import connection_created
+
+ def activate_wal_journal_mode(sender, connection, **kwargs):
+ cursor = connection.cursor()
+ cursor.execute("PRAGMA journal_mode = WAL;")
+
+ connection_created.connect(activate_wal_journal_mode)
+
else:
# Silent DEBUG output when running unit tests
LOGGING["handlers"]["console"]["level"] = "INFO" # type: ignore

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 2, 10:50 AM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3222543

Event Timeline