Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
django-biodblinks
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
hub
django-biodblinks
Commits
89ad0194
Commit
89ad0194
authored
4 years ago
by
Hervé Ménager
Browse files
Options
Downloads
Patches
Plain Diff
scripts to bootstrap django and test code
parent
4d24916a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
boot_django.py
+40
-0
40 additions, 0 deletions
boot_django.py
load_tests.py
+45
-0
45 additions, 0 deletions
load_tests.py
with
85 additions
and
0 deletions
boot_django.py
0 → 100644
+
40
−
0
View file @
89ad0194
# boot_django.py
#
# This file sets up and configures Django. It's used by scripts that need to
# execute as if running in a Django server.
import
os
import
django
from
django.conf
import
settings
BASE_DIR
=
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
"
biodblinks
"
))
def
boot_django
():
settings
.
configure
(
BASE_DIR
=
BASE_DIR
,
DEBUG
=
True
,
DATABASES
=
{
"
default
"
:
{
"
ENGINE
"
:
"
django.db.backends.sqlite3
"
,
"
NAME
"
:
os
.
path
.
join
(
BASE_DIR
,
"
db.sqlite3
"
),
}
},
INSTALLED_APPS
=
(
"
biodblinks
"
,),
TIME_ZONE
=
"
UTC
"
,
USE_TZ
=
True
,
LABLINKS_ID_PREFIX
=
"
https://django-biodblinks.pasteur.fr
"
,
LABLINKS_PROVIDER_ID
=
"
1111
"
,
LABLINKS_RESOURCE_NAME
=
"
django-biodblinks foo DB
"
,
LABLINKS_RESOURCE_DESCRIPTION
=
"
django-biodblinks foo DB: a non-existent database that should not be linked to
"
,
LABLINKS_CONTACT_EMAIL
=
"
noreply@pasteur.fr
"
,
)
django
.
setup
()
This diff is collapsed.
Click to expand it.
load_tests.py
0 → 100644
+
45
−
0
View file @
89ad0194
#!/usr/bin/env python
# load_tests.py
import
sys
from
unittest
import
TestSuite
from
boot_django
import
boot_django
boot_django
()
default_labels
=
[
"
biodblinks.tests
"
,
]
def
get_suite
(
labels
=
default_labels
):
from
django.test.runner
import
DiscoverRunner
runner
=
DiscoverRunner
(
verbosity
=
1
)
failures
=
runner
.
run_tests
(
labels
)
if
failures
:
sys
.
exit
(
failures
)
# In case this is called from setuptools, return a test suite
return
TestSuite
()
if
__name__
==
"
__main__
"
:
labels
=
default_labels
if
len
(
sys
.
argv
[
1
:])
>
0
:
labels
=
sys
.
argv
[
1
:]
get_suite
(
labels
)
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