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.
early_report.py
-
class openmdao.test.early_report.BroadcastStream(*streams)[source]
Bases: object
Sends stream output to multiple streams.
-
close()[source]
-
flush()[source]
-
write(*arg)[source]
-
writeln(*arg)[source]
-
class openmdao.test.early_report.EarlyTestInfo[source]
Bases: nose.plugins.base.Plugin
This plugin writes test info (failures, run time) to
a file as the tests are running instead of waiting until
the end to report anything. Run nose
with the option --with-early to activate it.
-
addError(test, err, capt=None)[source]
-
addFailure(test, err, capt=None, tb_info=None)[source]
-
addSkip(test, *args, **kwargs)[source]
-
addSuccess(test, capt=None)[source]
-
configure(options, config)[source]
Configures the plugin.
-
finalize(result)[source]
-
formatErr(err)[source]
-
options(parser, env)[source]
Sets additional command line options.
-
report(stream)[source]
Report the test failures.
-
setOutputStream(stream)[source]
-
startContext(ctx)[source]
-
startTest(test)[source]
-
stopContext(ctx)[source]
-
stopTest(test)[source]
-
name = 'early'
-
score = 1001
-
class openmdao.test.early_report.TestInfo(test)[source]
Bases: object
-
end()[source]
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.Component
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.
-
execute()[source]
ExecCompWithDerivatives execute function
-
list_deriv_vars()[source]
Return the full Jacobian
-
provideJ()[source]
Calculate the Jacobian using our derivative expressions.
nosetimer.py
This plugin provides test timings to identify which tests might be
taking the most time. 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
rosen_suzuki.py
Model based on CONMIN test.
-
class openmdao.test.rosen_suzuki.NestedSimulation[source]
Bases: openmdao.main.assembly.Assembly
-
configure()[source]
-
class openmdao.test.rosen_suzuki.OptRosenSuzukiComponent[source]
Bases: openmdao.main.component.Component
- Array x
- default: ‘[]’
- iotype: ‘in’
- low: -10
- high: 99
- comparison_mode: 1
- vartypename: ‘Array’
- assumed_default: True
- Float opt_objective
- default: ‘0.0’
- iotype: ‘out’
- vartypename: ‘Float’
- assumed_default: True
- Float result
- default: ‘0.0’
- iotype: ‘out’
- vartypename: ‘Float’
- assumed_default: True
-
configure()[source]
-
execute()[source]
calculate the new objective value
-
class openmdao.test.rosen_suzuki.PostProc[source]
Bases: openmdao.main.component.Component
Dummy post-processor.
- Float result_in
- default: ‘0.0’
- iotype: ‘in’
- vartypename: ‘Float’
- assumed_default: True
- Float result_out
- default: ‘0.0’
- iotype: ‘out’
- vartypename: ‘Float’
- assumed_default: True
-
execute()[source]
-
class openmdao.test.rosen_suzuki.PreProc[source]
Bases: openmdao.main.component.Component
Dummy pre-processor.
- Array x_in
- default: ‘[ 1. 1. 1. 1.]’
- iotype: ‘in’
- low: -10
- high: 99
- comparison_mode: 1
- vartypename: ‘Array’
- assumed_default: False
- Array x_out
- default: ‘[]’
- iotype: ‘out’
- comparison_mode: 1
- vartypename: ‘Array’
- assumed_default: True
-
execute()[source]
-
class openmdao.test.rosen_suzuki.ScalingPostProc[source]
Bases: openmdao.test.rosen_suzuki.PostProc
Scaling post-processor.
- Float scaler
- default: ‘1.0’
- iotype: ‘in’
- vartypename: ‘Float’
- assumed_default: False
-
execute()[source]
-
class openmdao.test.rosen_suzuki.ScalingPreProc[source]
Bases: openmdao.test.rosen_suzuki.PreProc
Scaling pre-processor.
- Float scaler
- default: ‘1.0’
- iotype: ‘in’
- vartypename: ‘Float’
- assumed_default: False
-
execute()[source]
-
class openmdao.test.rosen_suzuki.Simulation[source]
Bases: openmdao.main.assembly.Assembly
-
configure()[source]
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
-
class openmdao.test.testing.TestFailureSummary[source]
Bases: nose.plugins.base.Plugin
This plugin lists the names of the failed tests. Run nose
with the option --with-fail-summary to activate it.
-
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 plugin.
-
options(parser, env)[source]
Sets additional command line options.
-
report(stream)[source]
Report the test failures.
-
startTest(test)[source]
-
name = 'fail-summary'
-
score = 1
-
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.loadTestsFromModule(self, module, path=None, discovered=False)[source]
Load all tests from module and return a suite containing
them. If the module has been discovered and is not test-like,
the suite will be empty by default, though plugins may add
their own tests.
-
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.