Skip to content

Aquaveo/tethysext-atcore

Repository files navigation

Status

Job Status Coverage
Build Status Build Status Total Coverage
Lint Status Lint Status
Unit Tests Unit Test Status Unit Test Coverage
Integration Tests Integration Test Status Integration Test Coverage

Installs

OS Dependencies

$ sudo apt update
$ sudo apt install gcc libgdal-dev g++ libhdf5-dev

Activate tethys environment

conda activate tethys

Install for Development:

Run the following command from the same directory as the setup.py

$ tethys install -d

Install for Production:

Run the following command from the same directory as the setup.py

$ tethys install

settings.py

Add the following to INSTALLED_APPS in your settings.py (tethys/tethys_portal/settings.py):

'datetimewidget',
'django_select2',
'taggit',

Testing

This extension has two types of tests: unit tests and integrated tests.

Setup

Some of the tests require a test database. The database must be a PostgreSQL 9.6 or higher with the postgis extension intalled. Create an empty database before hand. The default database connection string is:

'postgresql://tethys_super:[email protected]:5435/atcore_tests'

To specify a custom database connection string, define the ATCORE_TEST_DATABASE environment variable:

export ATCORE_TEST_DATABASE="postgresql://<username>:<password>@<ipaddress>:<port>/<dbname>"

Running the Tests

To run unit tests:

$ coverage run --rcfile=coverage.ini -m unittest -v tethysext.atcore.tests.unit_tests
$ coverage report

To run integrated tests, install extension in existing installation of Tethys and run:

$ t
$ coverage run --rcfile=coverage.ini <TETHYS_HOME>/src/manage.py test tethysext.atcore.tests.integrated_tests
$ coverage report

Linting

We are using flake8 to enforce the pep 8 standard. Any change to the rules can be made in the tox.ini file.

$ flake8 [dir]

Run All Tests

To run all of the test and linting with cumulative coverage:

. test.sh </path/to/tethys/manage.py>

Minify Scripts

The minified scripts were minified using the harmony branch of uglify-js. For example:

sudo apt install npm
sudo npm install -g mishoo/UglifyJS2#harmony
uglifyjs --compress --mangle -- input.js > input.min.js