Skip to content

Commit 1314917

Browse files
committed
[tests] Added runtests script, updated docs
1 parent bf8ac7b commit 1314917

4 files changed

Lines changed: 25 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,7 @@ jobs:
8585

8686
- name: Tests
8787
if: ${{ !cancelled() && steps.deps.conclusion == 'success' }}
88-
run: |
89-
coverage run runtests.py --parallel --noinput --exclude-tag=selenium_tests
90-
coverage run runtests.py --noinput --tag=selenium_tests
91-
coverage combine
92-
coverage xml
88+
run: ./runtests
9389
env:
9490
SELENIUM_HEADLESS: 1
9591
GECKO_LOG: 1

docs/developer/installation.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Install development dependencies:
5050

5151
.. code-block:: shell
5252
53-
pip install -e .[qa,rest]
53+
pip install -e .[qa,rest,selenium]
5454
pip install -r requirements-test.txt
5555
sudo npm install -g prettier
5656
@@ -82,7 +82,7 @@ Run tests with:
8282

8383
.. code-block:: shell
8484
85-
./runtests.py --parallel
85+
./runtests
8686
8787
Run quality assurance tests with:
8888

runtests

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -e
3+
4+
coverage run runtests.py --parallel --exclude-tag=selenium_tests
5+
coverage run runtests.py --tag=selenium_tests
6+
coverage combine
7+
coverage xml

tests/openwisp2/settings.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
11
import os
2+
import sys
23

34
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
4-
5-
SECRET_KEY = "@s8$swhj9du^aglt5+@ut^)wepr+un1m7r*+ixcq(-5i^st=y^"
5+
TESTING = "test" in sys.argv
66

77
DEBUG = True
8-
98
ALLOWED_HOSTS = []
109

10+
DATABASES = {
11+
"default": {
12+
"ENGINE": "django.db.backends.sqlite3",
13+
"NAME": "openwisp_utils.db",
14+
}
15+
}
16+
if TESTING and "--exclude-tag=selenium_tests" not in sys.argv:
17+
DATABASES["default"]["TEST"] = {
18+
"NAME": os.path.join(BASE_DIR, "openwisp_utils_tests.db"),
19+
}
20+
21+
SECRET_KEY = "@s8$swhj9du^aglt5+@ut^)wepr+un1m7r*+ixcq(-5i^st=y^"
22+
1123
INSTALLED_APPS = [
1224
"django.contrib.auth",
1325
"django.contrib.contenttypes",
@@ -76,15 +88,6 @@
7688
}
7789
]
7890

79-
DATABASES = {
80-
"default": {
81-
"ENGINE": "django.db.backends.sqlite3",
82-
"NAME": "openwisp_utils.db",
83-
"TEST": {
84-
"NAME": "openwisp_utils_test.db",
85-
},
86-
}
87-
}
8891
TEST_RUNNER = "openwisp_utils.metric_collection.tests.runner.MockRequestPostRunner"
8992
OPENWISP_ADMIN_SITE_CLASS = "test_project.site.CustomAdminSite"
9093

0 commit comments

Comments
 (0)