:py:mod:`fixtures` ================== .. py:module:: conda.testing.fixtures .. autoapi-nested-parse:: Collection of pytest fixtures used in conda tests. Functions --------- .. autoapisummary:: conda.testing.fixtures.suppress_resource_warning conda.testing.fixtures.tmpdir conda.testing.fixtures.clear_subdir_cache conda.testing.fixtures.disable_channel_notices conda.testing.fixtures.reset_conda_context conda.testing.fixtures.temp_package_cache conda.testing.fixtures.parametrized_solver_fixture conda.testing.fixtures.solver_classic conda.testing.fixtures.solver_libmamba conda.testing.fixtures._solver_helper Attributes ---------- .. autoapisummary:: conda.testing.fixtures.Solver .. py:function:: suppress_resource_warning() Suppress `Unclosed Socket Warning` It seems urllib3 keeps a socket open to avoid costly recreation costs. xref: https://github.com/kennethreitz/requests/issues/1882 .. py:function:: tmpdir(tmpdir, request) .. py:function:: clear_subdir_cache() .. py:function:: disable_channel_notices() Fixture that will set "context.number_channel_notices" to 0 and then set it back to its original value. This is also a good example of how to override values in the context object. .. py:function:: reset_conda_context() Resets the context object after each test function is run. .. py:function:: temp_package_cache(tmp_path_factory) Used to isolate package or index cache from other tests. .. py:function:: parametrized_solver_fixture(request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch) -> Iterable[Literal[libmamba, classic]] A parameterized fixture that sets the solver backend to (1) libmamba and (2) classic for each test. It's using autouse=True, so only import it in modules that actually need it. Note that skips and xfails need to be done _inside_ the test body. Decorators can't be used because they are evaluated before the fixture has done its work! So, instead of: @pytest.mark.skipif(context.solver == "libmamba", reason="...") def test_foo(): ... Do: def test_foo(): if context.solver == "libmamba": pytest.skip("...") ... .. py:function:: solver_classic(request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch) -> Iterable[Literal[classic]] .. py:function:: solver_libmamba(request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch) -> Iterable[Literal[libmamba]] .. py:data:: Solver .. py:function:: _solver_helper(request: pytest.FixtureRequest, monkeypatch: pytest.MonkeyPatch, solver: Solver) -> Iterable[Solver]