Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
1a093d76
Commit
1a093d76
authored
May 04, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qa: speed up SQlite tests by accessing DBs in unsafe mode (e.g. no sync)
parent
fbcf9c50
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
neo/scripts/runner.py
neo/scripts/runner.py
+2
-0
neo/storage/database/manager.py
neo/storage/database/manager.py
+1
-0
neo/storage/database/sqlite.py
neo/storage/database/sqlite.py
+8
-0
No files found.
neo/scripts/runner.py
View file @
1a093d76
...
...
@@ -402,6 +402,8 @@ Environment Variables:
return runner.buildReport(self.add_status)
def main(args=None):
from neo.storage.database.manager import DatabaseManager
DatabaseManager.UNSAFE = True
runner = TestRunner()
runner.run()
return sys.exit(not runner.was_successful())
...
...
neo/storage/database/manager.py
View file @
1a093d76
...
...
@@ -53,6 +53,7 @@ class DatabaseManager(object):
"""This class only describes an interface for database managers."""
ENGINES
=
()
UNSAFE
=
False
_deferred
=
0
_duplicating
=
_repairing
=
None
...
...
neo/storage/database/sqlite.py
View file @
1a093d76
...
...
@@ -78,6 +78,10 @@ class SQLiteDatabaseManager(DatabaseManager):
def
_connect
(
self
):
logging
.
info
(
'connecting to SQLite database %r'
,
self
.
db
)
self
.
conn
=
sqlite3
.
connect
(
self
.
db
,
check_same_thread
=
False
)
if
self
.
UNSAFE
:
q
=
self
.
query
q
(
"PRAGMA synchronous = OFF"
)
q
(
"PRAGMA journal_mode = MEMORY"
)
self
.
_config
=
{}
def
_commit
(
self
):
...
...
@@ -108,6 +112,10 @@ class SQLiteDatabaseManager(DatabaseManager):
raise
def
_setup
(
self
):
# SQLite does support transactional Data Definition Language statements
# but unfortunately, the built-in Python binding automatically commits
# between such statements. This anti-feature causes this method to be
# relatively slow; unit tests enables the UNSAFE boolean flag.
self
.
_config
.
clear
()
q
=
self
.
query
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment