Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.web
Commits
c56681c1
Commit
c56681c1
authored
8 years ago
by
André Anjos
Browse files
Options
Downloads
Patches
Plain Diff
[settings] Allow tests to be sped-up by preserving the test database
parent
5aa3792b
No related branches found
No related tags found
1 merge request
!194
Scheduler
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.rst
+11
-0
11 additions, 0 deletions
README.rst
beat/web/settings/test.py
+4
-2
4 additions, 2 deletions
beat/web/settings/test.py
with
15 additions
and
2 deletions
README.rst
+
11
−
0
View file @
c56681c1
...
...
@@ -294,6 +294,17 @@ Or, to generate an HTML report::
$ ./bin/coverate html
.. tip::
You may significatively speed-up your testing by re-using the same test
database from run to run. In order to do this, just specify the flag
``--keepdb`` when you run your tests::
$ ./bin/django test --settings=beat.web.settings.test -v 2 --keepdb
In this case, Django will create and keep a test database called
``test.sql3`` on your current directory. You may delete it when you're done.
.. _snapshot:
Local Development Server
...
...
This diff is collapsed.
Click to expand it.
beat/web/settings/test.py
+
4
−
2
View file @
c56681c1
...
...
@@ -36,8 +36,10 @@ ALLOWED_HOSTS = [
'
testserver
'
,
]
# To always use a (in-memory) sqlite3 database for the tests
DATABASES
[
'
default
'
]
=
{
'
ENGINE
'
:
'
django.db.backends.sqlite3
'
}
import
sys
if
'
-k
'
in
sys
.
argv
or
'
--keepdb
'
in
sys
.
argv
:
# keeps the SQLite3 database around to avoid re-running migrations
DATABASES
[
'
default
'
][
'
TEST
'
]
=
{
'
NAME
'
:
'
test.sql3
'
}
PREFIX
=
os
.
path
.
join
(
os
.
getcwd
(),
'
test_prefix
'
)
ALGORITHMS_ROOT
=
os
.
path
.
join
(
PREFIX
,
'
algorithms
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment