4.1. sdepy.test¶
-
sdepy.test= <sdepy.tests.shared._pytest_tester object>¶ Invoke the sdepy testing suite (requires pytest>=3.8.1 to be installed).
Parameters: - label : string
Sets the scope of tests. May be one of
'full'(run all tests),'fast'(avoid slow tests),'slow'(perform slow tests only),'quant'(perform quantitative tests only). Defaults to'fast'.- doctests : bool
If
True, doctests are performed in addition to the tests specified bylabel.- warnings : string
If
'pass'(default), allows warnings during tests. If'fail', fails tests that issue warnings.- rng : string, or numpy.random.Generator, or numpy.random.RandomState,
or callable, or None
Specifies the random number generator to be used across tests, and the test mode:
- If
'legacy'(default), tests are run using legacy numpy random generation with a fixed seed, and fail if realized errors of quantitative tests are not consistent with expected errors for the same seed. - If a
numpy.random.Generator, ornumpy.random.RandomStateinstance, or a callable with no parameters returning such object, this generator is used across tests; ifNone, the sdepy default random number generator is used. In both cases, realzied errors of quantitative tests are computed, but not checked; to make them available for inspection, useplotandoutidirparameters.
- If
- paths : int
Reference number of paths used by quantitative tests (the actual number of paths, linked to the given
path, may vary). Ifrngis set to'legacy', only values 100 and 100_000 are allowed.- plot : bool
If
True, execute test code that generates plots; needs matplotlib to be installed.- outdir : string, or None
If not
None, name of a valid directory in which realized errors of quantitative tests, and plot images if generated, are saved.- verborse : int
A nonzero value increases verbosity of tests.
- pytest_args : string, or iterable of strings, or None
If not
None, specifies an additional argument, or a list of additional arguments, passed topytest.main().
Returns: Trueif all tests passed,Falseotherwise.
Notes
Non backward compatible changes to the present testing interface may occur in the future, without prior warning.