Skip to content

unit_tests

Dominic Ford edited this page Feb 20, 2019 · 5 revisions

Running the 4GP unit tests

The 4GP code comes with a set of unit tests to validate your installation. These use the python unittest framework.

These tests include building a number of spectrum libraries using both SQLite and MySQL databases. For all the tests to pass, you need to create a local MySQL database for it to use called fourgp_unittest.

A MySQL user account with username fourgp_unittest and password fourgp_unittest is needed with full access to this database.

At a MySQL command line prompt, you can create this test database and user as follows:

CREATE USER 'fourgp_unittest'@'localhost' IDENTIFIED BY 'fourgp_unittest';
CREATE DATABASE fourgp_unittest;
GRANT ALL ON fourgp_unittest.* TO 'fourgp_unittest'@'localhost';

You can run the unit tests as follows:

source virtualenv/bin/activate
cd 4most-4gp/src/pythonModules/fourgp_speclib/fourgp_speclib/tests
python -m unittest discover
Clone this wiki locally