Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xavier Thompson
neoppod
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
Show 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:
...
@@ -402,6 +402,8 @@ Environment Variables:
return runner.buildReport(self.add_status)
return runner.buildReport(self.add_status)
def main(args=None):
def main(args=None):
from neo.storage.database.manager import DatabaseManager
DatabaseManager.UNSAFE = True
runner = TestRunner()
runner = TestRunner()
runner.run()
runner.run()
return sys.exit(not runner.was_successful())
return sys.exit(not runner.was_successful())
...
...
neo/storage/database/manager.py
View file @
1a093d76
...
@@ -53,6 +53,7 @@ class DatabaseManager(object):
...
@@ -53,6 +53,7 @@ class DatabaseManager(object):
"""This class only describes an interface for database managers."""
"""This class only describes an interface for database managers."""
ENGINES
=
()
ENGINES
=
()
UNSAFE
=
False
_deferred
=
0
_deferred
=
0
_duplicating
=
_repairing
=
None
_duplicating
=
_repairing
=
None
...
...
neo/storage/database/sqlite.py
View file @
1a093d76
...
@@ -78,6 +78,10 @@ class SQLiteDatabaseManager(DatabaseManager):
...
@@ -78,6 +78,10 @@ class SQLiteDatabaseManager(DatabaseManager):
def
_connect
(
self
):
def
_connect
(
self
):
logging
.
info
(
'connecting to SQLite database %r'
,
self
.
db
)
logging
.
info
(
'connecting to SQLite database %r'
,
self
.
db
)
self
.
conn
=
sqlite3
.
connect
(
self
.
db
,
check_same_thread
=
False
)
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
=
{}
self
.
_config
=
{}
def
_commit
(
self
):
def
_commit
(
self
):
...
@@ -108,6 +112,10 @@ class SQLiteDatabaseManager(DatabaseManager):
...
@@ -108,6 +112,10 @@ class SQLiteDatabaseManager(DatabaseManager):
raise
raise
def
_setup
(
self
):
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
()
self
.
_config
.
clear
()
q
=
self
.
query
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