PlateMaker autamated testing¶
Introduction to PlateMaker testing¶
PlateMaker
includes both tests written with unittest
and
doctest
. The ${PLATEMAKER_DIR}/test/test.py
script constructs
and runs a test suite combining tests in each, as specified by a
configuration file. An example configuration file can be found in
${PLATEMAKER_DIR}/test/test.config
.
There are three sections in the test configuration file. The
[unittest]
section lists python modules in
${PLATEMAKER_DIR}/test/unittest
from which tests are to be
run. For example, these settings:
[unittest]
TestPlateMakerApp = False
TestDervishPlateMaker = True
TestDataConversions = False
specify that tests in
${PLATEMAKER_DIR}/test/unittest/TestDervishPlateMaker.py
be run,
but those in other scripts in the unittest
dircectory be skipped.
The [modules]
section lists python modules from which to run tests
using the doctest
module. For example, this line:
PlateMaker.fvc = True
specifies that examples in help strings in
${PLATEMAKER_DIR}/python/PlateMaker/gvc.py
be run.
Finally, the [docs]
section specifies testing documents in
${PLATEMAKER_DIR}/test/doctests
which should be run.
Testing without DOS elements¶
To test without the DOS elements, begin by setting all elements in the
test.config
file that use DOS
to False
, then run the tests
using the -n
switch:
bash$ setup PlateMaker
bash$ cd $PLATEMAKER_DIR/test
bash$ python test.py -n test.config
Testing with faked dervish elements¶
To test with the DOS elements but without dervish
ones, begin by
setting all elements in the test.config
file that use dervish
to
False
.
Then, start a DOS
instance using the “fake” PlateMaker
:
bash$ setup PML
bash$ setup PlateMaker
bash$ architect -i PlateMakerTest -c $PLATEMAKER_DIR/etc/fake_platemaker.ini
Then actually run the tests:
bash$ cd $PLATEMAKER_DIR/test
bash$ python test.py test.config
Full tests¶
Begin by starting DOS
:
bash$ setup PML
bash$ setup PlateMaker
bash$ architect -i PlateMakerTest -c $PLATEMAKER_DIR/etc/platemaker.ini
Prepare a bash
session with environment variable pointing at the
running DOS
test instance:
bash$ setup PML
bash$ setup PlateMaker
bash$ source ${DOS_HOME}/instances/PlateMakerTest/scripts/dos_env.csh
Then actually run the tests:
bash$ cd $PLATEMAKER_DIR/test
bash$ python test.py test.config
Direct interaction from the DOS console¶
From the DOS
console, connect to dervish
using
select DERVISH
and to PlateMaker
with:
select PLATEMAKER
Commands can then be issued like
set seqid=16180
get data_dir