summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent (laptop) <philip.sargent@gmail.com>2021-05-13 23:15:30 +0300
committerPhilip Sargent (laptop) <philip.sargent@gmail.com>2021-05-13 23:15:30 +0300
commit9130160bd64f6ca45b33af592d842eee4c23820e (patch)
treea428ba8a6ece368a8fc6d7b852260c98d8cce78f
parent6410cc1090977784a84b0337f434933d4b32151e (diff)
downloadtroggle-9130160bd64f6ca45b33af592d842eee4c23820e.tar.gz
troggle-9130160bd64f6ca45b33af592d842eee4c23820e.tar.bz2
troggle-9130160bd64f6ca45b33af592d842eee4c23820e.zip
new tests for CAVERN and SURVEXPORT
-rw-r--r--README.txt4
-rw-r--r--core/TESTS/test_imports.py26
-rwxr-xr-xpre-run.sh1
3 files changed, 30 insertions, 1 deletions
diff --git a/README.txt b/README.txt
index 1648966..b8fa85a 100644
--- a/README.txt
+++ b/README.txt
@@ -72,7 +72,8 @@ Install Django using pip, not with apt, on your test system.
You will also definitely need sqlite3 even if you are planning to use another
database. Sqlite3 is used by the test harness system.
Your Linux installation almost certainly already includes python3 and pip3 but
-in case it doesn't install those like this:
+in case it doesn't install those.
+You also need survex - which installs a shedload of other packages.
$ sudo apt update
$ sudo apt dist-upgrade
@@ -82,6 +83,7 @@ $ sudo apt install sqlite3 sqlite3-doc
$ cd /usr/bin
$ sudo ln -s python3 python
$ sudo ln -s pip3 pip
+$ sudo apt install survex
Now install django etc.
$ cd [troggle]
diff --git a/core/TESTS/test_imports.py b/core/TESTS/test_imports.py
index 7445d25..54ea39c 100644
--- a/core/TESTS/test_imports.py
+++ b/core/TESTS/test_imports.py
@@ -20,12 +20,15 @@ https://docs.djangoproject.com/en/3.0/topics/testing/tools/
"""
import unittest
import re
+import subprocess
+
from django.test import TestCase, SimpleTestCase, Client
class SimpleTest(SimpleTestCase):
def test_test_setting(self):
from django.conf import settings
self.assertEqual(settings.EMAIL_BACKEND, 'django.core.mail.backends.locmem.EmailBackend')
+ import troggle.settings as settings
def test_import_TroggleModel(self):
from troggle.core.models.troggle import TroggleModel
def test_import_Cave(self):
@@ -105,5 +108,28 @@ class SimpleTest(SimpleTestCase):
from troggle.core.views.statistics import pathsreport, stats, dataissues
from troggle.core.views.survex import survexcaveslist, survexcavesingle, svx
+class SubprocessTest(TestCase):
+
+ @classmethod
+ def setUpTestData(cls):
+ pass
+
+ def setUp(self):
+ pass
+
+ def tearDown(self):
+ pass
+
+ def test_installs(self):
+ import troggle.settings as settings
+
+ for i in [settings.CAVERN, settings.SURVEXPORT]:
+ # Define command as string and then split() into list format
+ cmd = f'which {i}'.split()
+ try:
+ sp = subprocess.check_call(cmd, shell=False)
+ except subprocess.CalledProcessError:
+ self.assertTrue( False, f'no {i} installed')
+
diff --git a/pre-run.sh b/pre-run.sh
index 53e3c1c..8f31bee 100755
--- a/pre-run.sh
+++ b/pre-run.sh
@@ -16,6 +16,7 @@ find . -name \*.py -print0 | xargs -0 egrep -vc "#|^\s*$" | grep -v ":0$" | gr
python3 reset-django.py
echo After cleanup deletion, remake all migrations.
python3 manage.py makemigrations >/dev/null
+python3 manage.py migrate
python3 manage.py test
python3 manage.py check -v 3 --deploy 2>security-warnings.txt >/dev/null
python3 manage.py check -v 3 --deploy