Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
beat
beat.web
Commits
2fa4453c
Commit
2fa4453c
authored
May 08, 2020
by
Samuel GAIST
Browse files
[settings][test] Use new helper method to setup prefix and db
parent
b8fe5eec
Changes
1
Hide whitespace changes
Inline
Side-by-side
beat/web/settings/test.py
View file @
2fa4453c
...
...
@@ -27,9 +27,10 @@
# Django settings for tests
import
os
import
platform
from
.settings
import
*
# noqa
from
.
import
get_test_db_path
from
.
import
get_test_prefix_path
URL_PREFIX
=
""
...
...
@@ -41,17 +42,7 @@ TEMPLATES[0]["OPTIONS"]["debug"] = DEBUG # noqa
ALLOWED_HOSTS
=
[
"testserver"
]
if
platform
.
system
()
==
"Linux"
:
shm_path
=
"/dev/shm/beatweb"
# nosec
if
not
os
.
path
.
exists
(
shm_path
):
os
.
makedirs
(
shm_path
)
database_name
=
os
.
path
.
join
(
shm_path
,
"test.sqlite3"
)
else
:
here
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
database_name
=
os
.
path
.
join
(
here
,
"test.sqlite3"
)
DATABASES
[
"default"
][
"NAME"
]
=
database_name
# noqa
DATABASES
[
"default"
][
"NAME"
]
=
get_test_db_path
(
RUNNING_ON_CI
)
# noqa
DATABASES
[
"default"
][
"TEST"
]
=
{
"NAME"
:
DATABASES
[
"default"
][
"NAME"
]}
# noqa
DATABASES
[
"default"
][
"OPTIONS"
][
"timeout"
]
=
30
# noqa
DATABASES
[
"default"
][
"ATOMIC_REQUESTS"
]
=
True
# noqa
...
...
@@ -67,11 +58,7 @@ LOGGING["loggers"]["beat.web.utils.management.commands"]["handlers"] = [ # noqa
]
BASE_DIR
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__name__
))
if
platform
.
system
()
==
"Linux"
:
default_prefix
=
os
.
path
.
join
(
shm_path
,
"test_prefix"
)
# nosec
else
:
default_prefix
=
os
.
path
.
realpath
(
"./test_prefix"
)
PREFIX
=
os
.
environ
.
get
(
"BEAT_TEST_PREFIX"
,
default_prefix
)
PREFIX
=
os
.
environ
.
get
(
"BEAT_TEST_PREFIX"
,
get_test_prefix_path
(
RUNNING_ON_CI
))
ALGORITHMS_ROOT
=
os
.
path
.
join
(
PREFIX
,
"algorithms"
)
PLOTTERS_ROOT
=
os
.
path
.
join
(
PREFIX
,
"plotters"
)
LIBRARIES_ROOT
=
os
.
path
.
join
(
PREFIX
,
"libraries"
)
...
...
Write
Preview
Supports
Markdown
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