Spaces Data

Minimal test - lines (1537, 1580)

path: .spaces[36].spaces[6].metrics.loc.cloc
old: 12.0
new: 13.0

path: .spaces[36].spaces[6].metrics.loc.sloc
old: 42.0
new: 44.0

path: .spaces[36].spaces[6].metrics.loc.blank
old: 5.0
new: 6.0

path: .spaces[36].spaces[6].metrics.mi.mi_sei
old: 70.03714723970663
new: 69.41956667844327

path: .spaces[36].spaces[6].metrics.mi.mi_visual_studio
old: 43.7736440887671
new: 43.33292815117338

path: .spaces[36].spaces[6].metrics.mi.mi_original
old: 74.85293139179174
new: 74.09930713850648

Code

    def pytest_generate_tests(self, metafunc: "Metafunc") -> None:
        """Generate new tests based on parametrized fixtures used by the given metafunc"""

        def get_parametrize_mark_argnames(mark: Mark) -> Sequence[str]:
            args, _ = ParameterSet._parse_parametrize_args(*mark.args, **mark.kwargs)
            return args

        for argname in metafunc.fixturenames:
            # Get the FixtureDefs for the argname.
            fixture_defs = metafunc._arg2fixturedefs.get(argname)
            if not fixture_defs:
                # Will raise FixtureLookupError at setup time if not parametrized somewhere
                # else (e.g @pytest.mark.parametrize)
                continue

            # If the test itself parametrizes using this argname, give it
            # precedence.
            if any(
                argname in get_parametrize_mark_argnames(mark)
                for mark in metafunc.definition.iter_markers("parametrize")
            ):
                continue

            # In the common case we only look at the fixture def with the
            # closest scope (last in the list). But if the fixture overrides
            # another fixture, while requesting the super fixture, keep going
            # in case the super fixture is parametrized (#1953).
            for fixturedef in reversed(fixture_defs):
                # Fixture is parametrized, apply it and stop.
                if fixturedef.params is not None:
                    metafunc.parametrize(
                        argname,
                        fixturedef.params,
                        indirect=True,
                        scope=fixturedef.scope,
                        ids=fixturedef.ids,
                    )
                    break

                # Not requesting the overridden super fixture, stop.
                if argname not in fixturedef.argnames:
                    break

                # Try next super fixture, if any.