TestRunnerBase¶
-
class
astropy.tests.runner.TestRunnerBase(base_path)[source]¶ Bases:
objectThe base class for the TestRunner.
A test runner can be constructed by creating a subclass of this class and defining ‘keyword’ methods. These are methods that have the
keyworddecorator, these methods are used to construct allowed keyword arguments to therun_testsmethod as a way to allow customization of individual keyword arguments (and associated logic) without having to re-implement the wholerun_testsmethod.Examples
A simple keyword method:
class MyRunner(TestRunnerBase): @keyword('default_value'): def spam(self, spam, kwargs): """ spam : `str` The parameter description for the run_tests docstring. """ # Return value must be a list with a CLI parameter for pytest. return ['--spam={}'.format(spam)]
Attributes Summary
RUN_TESTS_DOCSTRINGMethods Summary
make_test_runner_in(path)Constructs a TestRunnerto run in the given path, and returns atest()function which takes the same arguments asTestRunner.run_tests.run_tests(**kwargs)Attributes Documentation
-
RUN_TESTS_DOCSTRING= '\n Run the tests for the package.\n\n This method builds arguments for and then calls ``pytest.main``.\n\n Parameters\n ----------\n {keywords}\n\n '¶
Methods Documentation
-
classmethod
make_test_runner_in(path)[source]¶ Constructs a
TestRunnerto run in the given path, and returns atest()function which takes the same arguments asTestRunner.run_tests.The returned
test()function will be defined in the module this was called from. This is used to implement theastropy.test()function (or the equivalent for affiliated packages).
-