fipy.tests package¶
Submodules¶
fipy.tests.doctestPlus module¶
- fipy.tests.doctestPlus.execButNoTest(name='__main__')¶
- fipy.tests.doctestPlus.register_skipper(flag, test, why, skipWarning=True)¶
Create a new doctest option flag for skipping tests
- Parameters:
flag (str) – Name of the option flag
test (function) – A function which should return True if the test should be run
why (str) – Explanation for why the test was skipped (to be used in a string “
Skipped %%(count)d doctest examples because %%(why)s
”)skipWarning (bool) – Whether or not to report on tests skipped by this flag (default True)
- fipy.tests.doctestPlus.report_skips()¶
Print out how many doctest examples were skipped due to flags
- fipy.tests.doctestPlus.testmod(m=None, name=None, globs=None, verbose=None, report=True, optionflags=0, extraglobs=None, raise_on_error=False, exclude_empty=False)¶
Test examples in the given module. Return (#failures, #tests).
Largely duplicated from
doctest.testmod()
, but using_SelectiveDocTestParser
.Test examples in docstrings in functions and classes reachable from module m (or the current module if m is not supplied), starting with m.__doc__.
Also test examples reachable from dict m.__test__ if it exists and is not None. m.__test__ maps names to functions, classes and strings; function and class docstrings are tested even if the name is private; strings are tested directly, as if they were docstrings.
Return (#failures, #tests).
See help(doctest) for an overview.
Optional keyword arg name gives the name of the module; by default use m.__name__.
Optional keyword arg globs gives a dict to be used as the globals when executing examples; by default, use m.__dict__. A copy of this dict is actually used for each docstring, so that each docstring’s examples start with a clean slate.
Optional keyword arg extraglobs gives a dictionary that should be merged into the globals that are used to execute examples. By default, no extra globals are used. This is new in 2.4.
Optional keyword arg verbose prints lots of stuff if true, prints only failures if false; by default, it’s true iff -v is in sys.argv.
Optional keyword arg report prints a summary at the end when true, else prints nothing at the end. In verbose mode, the summary is detailed, else very brief (in fact, empty if all tests passed).
Optional keyword arg optionflags or’s together module constants, and defaults to 0. This is new in 2.3. Possible values (see the docs for details):
DONT_ACCEPT_TRUE_FOR_1 DONT_ACCEPT_BLANKLINE NORMALIZE_WHITESPACE ELLIPSIS SKIP IGNORE_EXCEPTION_DETAIL REPORT_UDIFF REPORT_CDIFF REPORT_NDIFF REPORT_ONLY_FIRST_FAILURE
as well as FiPy’s flags:
GMSH SCIPY TVTK SERIAL PARALLEL PROCESSOR_0 PROCESSOR_0_OF_2 PROCESSOR_1_OF_2 PROCESSOR_0_OF_3 PROCESSOR_1_OF_3 PROCESSOR_2_OF_3
Optional keyword arg “raise_on_error” raises an exception on the first unexpected exception or failure. This allows failures to be postmortem debugged.
fipy.tests.lateImportTest module¶
fipy.tests.test module¶
- class fipy.tests.test.test(dist, **kw)¶
Bases:
test
Construct the command for dist, updating vars(self) with any keyword parameters.
- command_consumes_arguments = False¶
- description = 'run unit tests after in-place build (deprecated), for FiPy and its examples'¶
- finalize_options()¶
Set final values for all the options that this command supports. This is always called as late as possible, ie. after any option assignments from the command-line or from other commands have been done. Thus, this is the place to code option dependencies: if ‘foo’ depends on ‘bar’, then it is safe to set ‘foo’ from ‘bar’ as long as ‘foo’ still has the same value it was assigned in ‘initialize_options()’.
This method must be implemented by all command classes.
- initialize_options()¶
Set default values for all the options that this command supports. Note that these defaults may be overridden by other commands, by the setup script, by config files, or by the command-line. Thus, this is not the place to code dependencies between options; generally, ‘initialize_options()’ implementations are just a bunch of “self.foo = None” assignments.
This method must be implemented by all command classes.
- printPackageInfo()¶
- run_tests()¶
- sub_commands = []¶
- test_args¶
- user_options = [('test-module=', 'm', "Run 'test_suite' in specified module"), ('test-suite=', 's', "Run single test, case or suite (e.g. 'module.test_suite')"), ('test-runner=', 'r', 'Test runner to use'), ('inline', None, 'run FiPy with inline compilation enabled'), ('pythoncompiled=', None, "directory in which to put weave's work product"), ('Trilinos', None, 'run FiPy using Trilinos solvers'), ('Pysparse', None, 'run FiPy using Pysparse solvers (default)'), ('trilinos', None, 'run FiPy using Trilinos solvers'), ('pysparse', None, 'run FiPy using Pysparse solvers (default)'), ('scipy', None, 'run FiPy using SciPy solvers'), ('Scipy', None, 'run FiPy using SciPy solvers'), ('petsc', None, 'run FiPy using PETSc solvers'), ('no-pysparse', None, 'run FiPy without using the Pysparse solvers'), ('pyamg', None, 'run FiPy without using the PyAMG solvers'), ('pyamgx', None, 'run FiPy using the pyamgx solvers'), ('all', None, 'run all non-interactive FiPy tests (default)'), ('really-all', None, 'run *all* FiPy tests (including those requiring user input)'), ('examples', None, 'test FiPy examples'), ('modules', None, 'test FiPy code modules'), ('viewers', None, 'test FiPy viewer modules (requires user input)'), ('cache', None, 'run FiPy with Variable caching'), ('no-cache', None, 'run FiPy without Variable caching'), ('timetests=', None, 'file in which to put time spent on each test'), ('skfmm', None, 'run FiPy using the Scikit-fmm level set solver (default)'), ('lsmlib', None, 'run FiPy using the LSMLIB level set solver (default)'), ('deprecation-errors', None, 'raise Exceptions for all DeprecationWarnings')]¶
fipy.tests.testProgram module¶
Module contents¶
unit testing scripts no chapter heading