Package openmdao.test

This package contains classes and modules that are used to test openmdao.

cluster.py

Routines to support testing with cluster allocation.

openmdao.test.cluster.init_cluster(encrypted=True, clean_dir=True, allow_shell=False)[source]

If not already done, initializes the ResourceAllocationManager and adds a cluster using encrypted or unencrypted communication. Returns the name of the configured cluster.

openmdao.test.cluster.local_ssh_available()[source]

Return True if this user has an authorized key for this machine.

execcomp.py

ExecComp is a simple component that lets you easily define mathematical expressions.

class openmdao.test.execcomp.ExecComp(exprs=(), sleep=0)[source]

Bases: openmdao.main.component.Component

Given a list of assignment statements, this component creates input and output I/O traits at construction time. All variables appearing on the left-hand side of the assignments are outputs, and the rest are inputs. All variables are assumed to be of type Float.

exprs: list of strings

sleep: float
Time (in seconds) to sleep during execute.
execute()[source]

ExecComp execute function

class openmdao.test.execcomp.ExecCompWithDerivatives(exprs=(), derivatives=(), sleep=0, dsleep=0)[source]

Bases: openmdao.main.component_with_derivatives.ComponentWithDerivatives

Works as ExecComp, except derivatives can also be defined.

Given a list of assignment statements, this component creates input and output I/O traits at construction time. All variables appearing on the left-hand side of the assignments are outputs, and the rest are inputs. All variables are assumed to be of type Float.

calculate_first_derivatives()[source]

Calculate the first derivatives

execute()[source]

ExecCompWithDerivatives execute function

nosetimer.py

This plugin provides test timings to identify which tests might be
taking the most. From this information, it might be useful to couple
individual tests nose's `--with-profile` option to profile problematic
tests.

This plugin is heavily influenced by nose's `xunit` plugin.

Add this command to the way you execute nose::

    --with-test-timer

After all tests are executed, they will be sorted in ascending order.

(c) 2011 - Mahmoud Abdelkader (http://github.com/mahmoudimus)

LICENSE:
            DO WHAT THE !#$% YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004

 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> (slightly modified)

 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

            DO WHAT THE !#$% YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  0. You just DO WHAT THE !#$% YOU WANT TO.
class openmdao.test.nosetimer.TestTimer[source]

Bases: nose.plugins.base.Plugin

This plugin provides test timings

addError(test, err, capt=None)[source]
addFailure(test, err, capt=None, tb_info=None)[source]
addSuccess(test, capt=None)[source]
configure(options, config)[source]

Configures the test timer plugin.

options(parser, env)[source]

Sets additional command line options.

report(stream)[source]

Report the test times

startTest(test)[source]

Initializes a timer before starting a test.

name = 'test-timer'
score = 1

TEST

test_execcomp.py

Test of the ExecComp component.

class openmdao.test.test.test_execcomp.execCompTest(methodName='runTest')[source]

Bases: unittest.case.TestCase

setUp()[source]
test_execcomp()[source]
test_execcomp_derivatives()[source]

testing.py

openmdao.test.testing.filter_config(hostlist, config, options)[source]

Looks for sections in the config file that match the host names specified in options.hosts.

Returns a list of host names that match the given options.

openmdao.test.testing.is_dev_install()[source]
openmdao.test.testing.read_config(options)[source]

Reads the config file specified in options.cfg.

Returns a tuple of the form (hosts, config), where hosts is the list of host names and config is the ConfigParser object for the config file.

openmdao.test.testing.run_openmdao_suite(argv=None)[source]

This function is exported as a script that is runnable as part of an OpenMDAO virtual environment as openmdao test.

This function wraps nosetests, so any valid nose args should also work here.

openmdao.test.testing.run_openmdao_suite_deprecated()[source]
OpenMDAO Home

Table Of Contents

Previous topic

Package openmdao.main

Next topic

Package openmdao.units

This Page