Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9312345
D8300.id29976.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D8300.id29976.diff
View Options
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
Details
Attached
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
Attached To
D8300: sqlite: Try to mitigate locked database when running cypress tests
Event Timeline
Log In to Comment