astro.test package

Subpackages

Submodules

astro.test.dependency_test module

astro.test.dpu_unittestjob module

astro.test.dpu_unittests module

astro.test.firewall_test module

class astro.test.firewall_test.TestNetworkConnectionToDatabase(methodName='runTest')

Bases: unittest.case.TestCase

setUp()
test_node_connection()
astro.test.firewall_test.connect(hostname, port, timeout)

astro.test.make_test_data module

astro.test.matplotlib_agg module

Import matplotlib with the Agg backend.

The Agg backend is useful when no screen is available or screen output is undesirable. For example when running tests.

Setting the matplotlib Agg backend must be done before importing pyplot, and therefore has to be done before importing e.g. InspectFigure:

import matplotlib matplotlib.use(‘Agg’) import InspectFigure

PEP8 wants module level imports before code execution, and will therefore complain about the above solution. This is not necessarily a problem but cannot be ignored locally in many editors, e.g. PyCharm.

Another solution is to switch the backend after importing:

import InspectFigure import matplotlib.pyplot matplotlib.pyplot.switch_backend(‘Agg’)

However, this is not supported in the default Astro-WISE matplotlib (1.0.0).

Therefore, the simplest solution that produces no PEP8 warnings is to use this module.

import matplotlib_agg import InspectFigure

astro.test.multicasetest module

class astro.test.multicasetest.TestMultipleCases(methodName='runTest')

Bases: unittest.case.TestCase

A class whose instances test multiple cases.

By default, the test code itself should be placed in a method named ‘runTest’.

If the fixture may be used for many test cases, create as many test methods as are needed. When instantiating such a TestCase subclass, specify in the constructor arguments the name of the test method that the instance is to execute.

Test authors should subclass TestCase for their own tests. Construction and deconstruction of the test’s environment (‘fixture’) can be implemented by overriding the ‘setUp’ and ‘tearDown’ methods respectively.

Instances should define an iterable atribute ‘cases’. The test methods will be called once for each item in self.cases. Each case may generate its own failure or error. Therefore each test method may generate multiple failures/errors. A test method is deemed to have passed succesfully if none of the cases genereated an error

The cases attribute can be generated at class definition time, at initialization time or in the setUp method

If it is necessary to override the __init__ method, the base class __init__ method must always be called. It is important that subclasses should not change the signature of their __init__ method, since instances of the classes are instantiated automatically by parts of the framework in order to be run. Hence, the __init__ method should not be changed to pass a list of cases to the instance

cases = None

astro.test.regression_test module

astro.test.startup_test module

astro.test.testpath module

Module contents

Procedures to test the functionality and integrity of the software

This packag contains packages/modules and a few scripts to be used from the command-line.

Package/Module | Provided functionality

multicasetest | Module containing framework for handling multiple test cases
that differ only in a single aspect.

functional | Package containing all functional tests. processing | Package containing all processing tests. recipes | Package containing all recipes tests. filerecipes | ? services | ? database | ? omegacen | Tests that rely on the OmegaCEN infrastructure specifics. ——————————————————————————–

Additionally the following scripts are available in the astro/test directory :

dependency_test.py - Verifies the existence of required packages. regression_test.py - Runs all functional, processing and/or recipes tests. make_test_data.py - Produces test data.