Example #1
0
def fixtures(
    ctx: click.Context,
    config: str,
    project_root: Optional[Path],
    config_path: Optional[Path],
    path: Tuple[str],
    exclude: Tuple[str],
    fixture_path: Tuple[Path],
    search: Optional[str],
    show_scopes: bool,
    show_docstrings: bool,
    show_dependencies: bool,
    show_dependency_trees: bool,
    full: bool,
):
    """Show information on fixtures."""
    configure_path(project_root)
    paths = [Path(p) for p in path]
    mod_infos = get_info_for_modules(paths, exclude)
    modules = list(load_modules(mod_infos))
    tests = list(get_tests_in_modules(modules, capture_output=True))

    filtered_fixtures = list(
        filter_fixtures(_DEFINED_FIXTURES, query=search, paths=fixture_path)
    )

    output_fixtures(
        fixtures=filtered_fixtures,
        tests=tests,
        show_scopes=show_scopes or full,
        show_docstrings=show_docstrings or full,
        show_dependencies=show_dependencies or full,
        show_dependency_trees=show_dependency_trees or full,
    )
Example #2
0
def _(path=each(THIS_FILE.parent / "the-fixture-is-not-in-this-file.py")):
    fixtures = [Fixture(f) for f in [named_fixture]]
    assert list(filter_fixtures(fixtures, paths=[path])) == []
Example #3
0
def _(query=each("echo", "foobar", "wizbang")):
    fixtures = [Fixture(f) for f in [named_fixture, marker_fixture]]
    assert list(filter_fixtures(fixtures, query=query)) == []
Example #4
0
def _(path=each(THIS_FILE, THIS_FILE.parent, THIS_FILE.parent.parent)):
    fixtures = [Fixture(f) for f in [named_fixture]]
    assert list(filter_fixtures(fixtures, paths=[path])) == fixtures
Example #5
0
def _(query=each("marker", "mark", "ret", "return", '"')):
    fixtures = [Fixture(f) for f in [named_fixture, marker_fixture]]
    assert list(filter_fixtures(fixtures,
                                query=query)) == [Fixture(marker_fixture)]
Example #6
0
def _(query=each("test", "test_collect", "collect", "t_coll")):
    fixtures = [Fixture(f) for f in [named_fixture]]
    assert list(filter_fixtures(fixtures, query=query)) == fixtures
Example #7
0
def _(query=each("named_fixture", "named", "fixture", "med_fix")):
    fixtures = [Fixture(f) for f in [named_fixture]]
    assert list(filter_fixtures(fixtures, query=query)) == fixtures
Example #8
0
def _():
    fixtures = [Fixture(f) for f in [named_fixture, marker_fixture]]
    assert list(filter_fixtures(fixtures)) == fixtures
Example #9
0
def _():
    assert list(filter_fixtures([])) == []