skbase.testing.BaseFixtureGenerator#
- class skbase.testing.BaseFixtureGenerator[source]#
Fixture generator for skbase testing functionality.
- Test classes inheriting from this and not overriding pytest_generate_tests
will have object and scenario fixtures parametrized out of the box.
Descendants can override: object_type_filter: str, class variable; None or scitype string
e.g., “forecaster”, “transformer”, “classifier”, see BASE_CLASS_SCITYPE_LIST which objects are being retrieved and tested
- exclude_objectsstr or list of str, or None, default=None
names of object classes to exclude in retrieval; None = no objects are excluded
- excluded_testsdict with str keys and list of str values, or None, default=None
str keys must be object names, value keys must be lists of test names names of tests (values) to exclude for object with name as key None = no tests are excluded
- valid_tagslist of str or None, default = None
list of valid tags, None = all tags are valid
- valid_base_typeslist of str or None, default = None
list of valid base types (strings), None = all base types are valid
- fixture_sequence: list of str
sequence of fixture variable names in conditional fixture generation
- _generate_[variable]: object methods, all (test_name: str, **kwargs) -> list
- generating list of fixtures for fixture variable with name [variable]
to be used in test with name test_name
- can optionally use values for fixtures earlier in fixture_sequence,
these must be input as kwargs in a call
- is_excluded: static method (test_name: str, est: class) -> bool
- whether test with name test_name should be excluded for object est
should be used only for encoding general rules, not individual skips individual skips should go on the excluded_tests list
requires _generate_object_class and _generate_object_instance as is
- Attributes:
- exclude_objects
- excluded_tests
- object_type_filter
- valid_base_types
- valid_tags
Methods
Return dict with methods _generate_[variable] collected in a dict.
is_excluded(test_name, est)Shorthand to check whether test test_name is excluded for object est.
object_instance(request)object_instance fixture definition for indirect use.
pytest_generate_tests(metafunc)Test parameterization routine for pytest.
- pytest_generate_tests(metafunc)[source]#
Test parameterization routine for pytest.
This uses create_conditional_fixtures_and_names and generator_dict to create the fixtures for a mark.parametrize decoration of all tests.
- generator_dict()[source]#
Return dict with methods _generate_[variable] collected in a dict.
- The returned dict is the one required by create_conditional_fixtures_and_names,
used in this _conditional_fixture plug-in to pytest_generate_tests, above.
- Returns:
- generator_dictdict, with keys [variable], where
- [variable] are all strings such that self has a static method
named _generate_[variable](test_name: str, **kwargs)
value at [variable] is a reference to _generate_[variable]