testing#
类#
函数#
|
一个函数作用域的 fixture,返回 CondaCLIFixture 实例。 |
|
一个 monkeypatch fixture,在每次测试后重置上下文。 |
|
一个函数作用域的 fixture,返回 PathFactoryFixture 实例。 |
|
一个函数作用域的 fixture,返回 TmpChannelFixture 实例。 |
|
一个函数作用域的 fixture,返回 TmpEnvFixture 实例。 |
|
一个函数作用域的 fixture,返回一个临时环境目录。 |
|
一个函数作用域的 fixture,返回一个临时包缓存目录。 |
属性#
- on_win#
- deprecated#
- class CondaCLIFixture#
- capsys: pytest.CaptureFixture | _pytest.capture.MultiCapture#
- __call__(*argv: str | os.PathLike | pathlib.Path, raises: type[Exception] | tuple[type[Exception], Ellipsis]) tuple[str, str, pytest.ExceptionInfo]#
- __call__(*argv: str | os.PathLike | pathlib.Path) tuple[str, str, int]
测试 conda CLI。模拟 conda.cli.main.main 中的操作。
conda ... == conda_cli(...)
- 参数:
argv -- 要解析的参数。
raises -- 要捕获的预期异常。如果提供,将返回引发的异常而不是退出代码(参见 pytest.raises 和 pytest.ExceptionInfo)。
- 返回:
命令结果(stdout、stderr、退出代码或 pytest.ExceptionInfo)。
- class PathFactoryFixture#
- tmp_path: pathlib.Path#
- class TmpChannelFixture#
- path_factory: PathFactoryFixture#
- conda_cli: CondaCLIFixture#
- __call__(*packages: str) collections.abc.Iterator[tuple[pathlib.Path, str]]#
- class TmpEnvFixture#
- path_factory: PathFactoryFixture | pytest.TempPathFactory#
- conda_cli: CondaCLIFixture#
- get_path() pathlib.Path#
- __call__(*packages: str, prefix: str | os.PathLike | None = None) collections.abc.Iterator[pathlib.Path]#
生成一个包含所提供软件包的 conda 环境。
- 参数:
packages -- 要安装到环境中的软件包
prefix -- 要在其中安装 conda 环境的前缀
- 返回:
conda 环境的前缀
- conda_cli(capsys: pytest.CaptureFixture) collections.abc.Iterator[CondaCLIFixture]#
一个函数作用域的 fixture,返回 CondaCLIFixture 实例。
对于任何当前测试本地的命令(例如,创建一个仅在测试中使用的 conda 环境),请使用此方法。
- context_aware_monkeypatch(monkeypatch: pytest.MonkeyPatch) pytest.MonkeyPatch#
一个 monkeypatch fixture,在每次测试后重置上下文。
- path_factory(tmp_path: pathlib.Path) collections.abc.Iterator[PathFactoryFixture]#
一个函数作用域的 fixture,返回 PathFactoryFixture 实例。
使用此方法为测试生成任意数量的临时路径,这些路径是唯一的且尚不存在。
- tmp_channel(path_factory: PathFactoryFixture, conda_cli: CondaCLIFixture) collections.abc.Iterator[TmpChannelFixture]#
一个函数作用域的 fixture,返回 TmpChannelFixture 实例。
- tmp_env(path_factory: PathFactoryFixture, conda_cli: CondaCLIFixture) collections.abc.Iterator[TmpEnvFixture]#
一个函数作用域的 fixture,返回 TmpEnvFixture 实例。
当创建当前测试本地的 conda 环境时,请使用此方法。
- tmp_envs_dir(path_factory: PathFactoryFixture, mocker: pytest_mock.MockerFixture) collections.abc.Iterator[pathlib.Path]#
一个函数作用域的 fixture,返回一个临时环境目录。
- tmp_pkgs_dir(path_factory: PathFactoryFixture, mocker: pytest_mock.MockerFixture) collections.abc.Iterator[pathlib.Path]#
一个函数作用域的 fixture,返回一个临时包缓存目录。
- conda_ensure_sys_python_is_base_env_python()#
- conda_move_to_front_of_PATH()#