repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
conda | tests/data/build-index5-json.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import json
from os.path import abspath, dirname, join
from pprint import pprint
from conda.core.subdir_data import SubdirData
DATA_DIR = abspath(join(dirname(__file__), "repodata"))
def save_data_source(url, name):
raw_repodata_str = Su... | 162 | 4,278 |
conda | tests/data/build-index2-json.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import json
from os.path import abspath, dirname, join
from conda.core.subdir_data import Channel, SubdirData
DATA_DIR = abspath(join(dirname(__file__), "repodata"))
def save_data_source(url, name):
sd = SubdirData(Channel(url))
repo... | 195 | 4,490 |
conda | tests/data/recipes/generate_recipes_readme.py | .py | #!/usr/bin/env python3
# Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Generate a test-recipes README from rendered package metadata.
This reads package metadata from artifacts in ``tests/data/test-recipes``:
- ``info/index.json`` for package name and version (source of truth)
- ``info/re... | 244 | 7,837 |
conda | tests/data/recipes/small_python_package/small_python_package/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
A small Python package for conda testing.
"""
__version__ = "1.0.0"
def hello():
"""Return a friendly greeting."""
return "Hello from small-python-package!"
| 13 | 247 |
conda | tests/data/recipes/small_python_package/small_python_package/cli.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
CLI interface for small-python-package.
"""
import argparse
from . import __version__, hello
def main():
"""Main CLI entry point."""
parser = argparse.ArgumentParser(
description="A small Python package for conda testing"... | 32 | 677 |
conda | tests/data/pkg_cache/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import json
import sys
from conda.core.package_cache_data import PackageCacheRecord
if sys.version_info < (3, 12):
from importlib_resources import files
else:
from importlib.resources import files
def load_data_file(filename):
wi... | 24 | 579 |
conda | tests/auxlib/test_logz.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from requests import Request, Response
from conda.auxlib.logz import stringify
def test_stringify_json_response():
request = Request("GET", "https://example.com/api/endpoint").prepare()
response = R... | 24 | 679 |
conda | tests/models/test_prefix_graph.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import time
import warnings
from functools import cache
from pprint import pprint
import pytest
from pytest import MonkeyPatch
import conda.models.prefix_graph
from conda.base.context import context, reset_context
from conda.exceptions import ... | 1,026 | 27,348 |
conda | tests/models/test_dist.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from logging import getLogger
from os.path import join
from tempfile import gettempdir
import pytest
from pytest import MonkeyPatch
from conda.base.constants import UNKNOWN_CHANNEL
from conda.base.context import context, reset_context
from con... | 173 | 5,385 |
conda | tests/models/test_channel.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from logging import getLogger
from tempfile import gettempdir
import pytest
from pytest import MonkeyPatch
from conda.auxlib.ish import dals
from conda.base.constants import DEFAULT_CHANNELS
from conda.base.context import Context, context, res... | 1,418 | 54,298 |
conda | tests/models/test_version.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from copy import copy
from random import shuffle
import pytest
from conda.exceptions import InvalidVersionSpec
from conda.models.version import VersionOrder, VersionSpec, normalized_version, ver_eval
def test_version_order():
versions = ... | 437 | 14,114 |
conda | tests/models/test_match_spec.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda.base.constants import CONDA_PACKAGE_EXTENSION_V1, CONDA_PACKAGE_EXTENSION_V2
if TYPE_CHECKING:
from pytest_benchmark.fixture import BenchmarkFix... | 2,222 | 75,723 |
conda | tests/models/test_environment.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from dataclasses import fields
from types import SimpleNamespace
from typing import TYPE_CHECKING
import pytest
from conda.base.constants import ChannelPriority
from conda.base.context import context, reset... | 1,133 | 39,294 |
conda | tests/models/test_enums.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for conda.models.enums module."""
from __future__ import annotations
from contextlib import nullcontext
from dataclasses import dataclass
from typing import TYPE_CHECKING
import pytest
from conda.exceptions import CondaUpgradeError
... | 111 | 3,152 |
conda | tests/models/test_package_info.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from conda.base.context import context
from conda.models.channel import Channel
from conda.models.enums import FileMode, PathEnum
from conda.models.package_info import Noarch, PackageInfo, PackageMetadata
from conda.models.records import Package... | 55 | 1,926 |
conda | tests/models/test_records.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda.base.context import context
from conda.core.prefix_data import PrefixData
from conda.models.channel import Channel
from conda.models.enums import PackageType
from conda.models.match_spec import MatchSpec
from conda.mode... | 256 | 7,795 |
conda | tests/env/utils.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from conda.cli.main_env_create import configure_parser as create_configure_parser
from conda.cli.main_env_update import configure_parser as update_configure_parser
from conda.cli.main_export import configure_parser as export_configure_parser
... | 20 | 562 |
conda | tests/env/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from os.path import dirname, join
def support_file(filename):
return join(dirname(__file__), "support", filename)
def remote_support_file(filename, port: int):
assert port is not None
return f"http://127.0.0.1:{port}/{filename}"
| 13 | 320 |
conda | tests/env/test_pip_util.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda.env.pip_util import get_pip_installed_packages
pip_output_attrs = """
Collecting attrs
Using cached https://files.pythonhosted.org/packages/23/96/d828354fa2dbdf216eaa7b7de0db692f12c234f7ef888cc14980ef40d1d2/attrs-19... | 82 | 4,430 |
conda | tests/env/test_create.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import json
import subprocess
from pathlib import Path
from typing import TYPE_CHECKING
from uuid import uuid4
import pytest
from conda.base.context import context, reset_context
from conda.common.compat imp... | 520 | 15,673 |
conda | tests/env/test_env.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import os
import random
from io import StringIO
from typing import TYPE_CHECKING
from unittest.mock import patch
import pytest
from conda.common.serialize import yaml
from conda.env.env import (
VALID_KE... | 523 | 13,676 |
conda | tests/env/specs/test_yaml_file.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from unittest import mock
import pytest
from conda.env import env
from conda.env.specs.cep_24 import Cep24YamlFileSpec
from conda.env.specs.yaml_file import YamlFileSpec
from conda.exceptions import EnvironmentFileNotFound, PluginError
from .... | 59 | 1,534 |
conda | tests/env/specs/test_requirements.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda.env.specs.requirements import RequirementsSpec
from conda.exceptions import CondaValueError, PluginError
from conda.models.environment import Environment
from .. import support_file
def test_no_environment_file():
... | 38 | 1,075 |
conda | tests/env/specs/test_explicit.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda.env.specs.explicit import ExplicitSpec
from conda.exceptions import CondaValueError, PluginError
from conda.models.environment import Environment
from .. import support_file
def test_no_environment_file():
spec =... | 34 | 967 |
conda | tests/env/installers/test_conda_installer_explicit.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Test conda explicit installer functionality."""
import pytest
from conda.env.installers.conda import install
from conda.env.specs.explicit import ExplicitSpec
from conda.models.environment import Environment
from conda.models.match_spec imp... | 156 | 5,134 |
conda | tests/env/support/advanced-pip/argh/argh/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
A simple argparse wrapper.
"""
__version__ = "0.26.2"
| 8 | 134 |
conda | tests/env/support/advanced-pip/module_to_install_in_editable_mode/setup.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from setuptools import setup
setup(
name="module_to_install_in_editable_mode",
packages=[],
)
| 9 | 178 |
conda | tests/plugins/test_settings.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import json
import logging
from contextlib import nullcontext
import pytest
from pytest import MonkeyPatch
from ruamel.yaml import YAML
from conda import plugins
from conda.base.context import context, reset_context
from conda.common.configura... | 603 | 17,565 |
conda | tests/plugins/test_exception_observers.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import sys
from typing import TYPE_CHECKING
import pytest
from conda import CondaError, plugins
from conda import __version__ as CONDA_VERSION
from conda.exception_handler import ExceptionHandler
from conda.... | 380 | 11,103 |
conda | tests/plugins/test_pre_commands.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda import plugins
from conda.plugins.reporter_backends import plugins as reporter_backends_plugins
from conda.plugins.types import CondaPreCommand
class PreCommandPlugin:
def pre_command_action(self, command: str) ->... | 65 | 1,970 |
conda | tests/plugins/test_plugin_manager.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import json
from importlib import import_module
from typing import TYPE_CHECKING
import pytest
if TYPE_CHECKING:
from conda.plugins.manager import CondaPluginManager
from conda.testing.fixtures impor... | 124 | 3,313 |
conda | tests/plugins/test_config.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""
Tests for plugin configuration
"""
from pathlib import Path
from conda.auxlib.ish import dals
from conda.common.configuration import (
Configuration,
EnvRawParameter,
)
from conda.plugins.config import PluginConfig
def test_plugi... | 158 | 4,432 |
conda | tests/plugins/test_manager.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import logging
import re
import sys
from dataclasses import dataclass
from typing import TYPE_CHECKING
import pluggy
import pytest
from packaging.version import Version
from conda import plugins
from conda.... | 413 | 13,936 |
conda | tests/plugins/test_error_hints.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda import CondaError, plugins
from conda._private.exception_guidance import GuidanceHint
if TYPE_CHECKING:
from collections.abc import Iterator
... | 143 | 3,989 |
conda | tests/plugins/test_post_commands.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda import plugins
from conda.plugins.reporter_backends import plugins as reporter_backends_plugins
from conda.plugins.types import CondaPostCommand
class PostCommandPlugin:
def post_command_action(self, command: str)... | 65 | 2,000 |
conda | tests/plugins/test_post_solves.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda import plugins
from conda.exceptions import DryRunExit
from conda.plugins import solvers
if TYPE_CHECKING:
from pytest_mock import MockerFixture... | 86 | 2,184 |
conda | tests/plugins/test_transaction_hooks.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda import plugins
from conda.core.path_actions import Action
from conda.plugins import package_extractors, solvers
from conda.plugins.types import Conda... | 168 | 4,971 |
conda | tests/plugins/test_hookspec.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
import conda.plugins.hookspec
@pytest.mark.parametrize(
"constant",
["spec_name"],
)
def test_deprecations(constant: str) -> None:
with pytest.deprecated_call():
getattr(conda.plugins.hookspec, constant)
| 15 | 316 |
conda | tests/plugins/test_package_extractors.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from contextlib import nullcontext
from typing import TYPE_CHECKING
import pytest
from conda import plugins
from conda.base.context import context
from conda.exceptions import PluginError
from conda.plugins.... | 143 | 4,701 |
conda | tests/plugins/test_reporter_backends.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import pytest
from conda import plugins
from conda.base.constants import (
DEFAULT_CONSOLE_REPORTER_BACKEND,
DEFAULT_JSON_REPORTER_BACKEND,
)
from conda.plugins.reporter_backends import plugins as def... | 108 | 3,106 |
conda | tests/plugins/test_environment_export.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for environment export functionality."""
from __future__ import annotations
import json
from contextlib import nullcontext
from typing import TYPE_CHECKING
import pytest
import yaml
from conda.common.serialize import yaml as yaml_se... | 724 | 24,695 |
conda | tests/plugins/test_lazy_types.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Verify ``conda.plugins.types`` loads lazily and its deprecated re-exports."""
from __future__ import annotations
import os
import subprocess
import sys
import textwrap
import pytest
_DEPRECATED_NAMES = (
"CondaAuthHandler",
"Conda... | 96 | 2,749 |
conda | tests/plugins/test_health_checks.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from conda import plugins
from conda.base.context import context
from conda.exceptions import CondaSystemExit
from conda.plugins.subcommands import doctor
from conda.plugins.types import CondaHealthCheck
class HealthCheckPlugin:... | 140 | 4,264 |
conda | tests/plugins/test_virtual_packages.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import os
import platform
from typing import TYPE_CHECKING
import pytest
from pytest import MonkeyPatch
import conda.core.index
from conda import __version__, plugins
from conda.auxlib import NULL
from conda... | 520 | 17,039 |
conda | tests/plugins/test_solvers.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import logging
import pytest
from conda import plugins
from conda.base.context import context, reset_context
from conda.core import solve
from conda.exceptions import PluginError
from conda.plugins.hookspec import CondaSpecs
from conda.plugins... | 145 | 4,195 |
conda | tests/plugins/test_auth_handlers.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import pytest
from requests.auth import HTTPBasicAuth
from conda import plugins
from conda.exceptions import PluginError
PLUGIN_NAME = "custom_auth"
PLUGIN_NAME_ALT = "custom_auth_alt"
class CustomCondaAuth(HTTPBasicAuth):
def __init__(... | 83 | 2,328 |
conda | tests/plugins/test_env_specs.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
import functools
from pathlib import Path
from xml.etree import ElementTree
import pytest
from conda import plugins
from conda.auxlib.ish import dals
from conda.exceptions import (
AmbiguousEnvironmentSpecPlugin,
EnvironmentSpecPluginN... | 727 | 22,723 |
conda | tests/plugins/test_previews.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Unit tests for conda.plugins.previews."""
from __future__ import annotations
from typing import TYPE_CHECKING
from unittest.mock import MagicMock
import conda.plugins.previews as previews
from conda._preview.env_setup import PREVIEW_LABEL ... | 134 | 4,146 |
conda | tests/plugins/test_pre_solves.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda import plugins
from conda.exceptions import DryRunExit
from conda.plugins import solvers
if TYPE_CHECKING:
from pytest_mock import MockerFixture... | 86 | 2,153 |
conda | tests/plugins/test_types.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for plugin type classes (CondaEnvironmentSpecifier and CondaEnvironmentExporter)."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda.env.specs.requirements import RequirementsSpec
from co... | 161 | 5,304 |
conda | tests/plugins/test_subcommands.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
import re
from dataclasses import dataclass
from typing import TYPE_CHECKING
import pytest
from conda import plugins
from conda.auxlib.ish import dals
from conda.base.context import context
from conda.cli.co... | 375 | 11,295 |
conda | tests/plugins/test_request_headers.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda.common.url import urlparse
from conda.plugins import hookimpl
from conda.plugins.types import CondaRequestHeader
if TYPE_CHECKING:
from collect... | 100 | 3,340 |
conda | tests/plugins/subcommands/conftest.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Shared fixtures for doctor and fix subcommand tests."""
from __future__ import annotations
import json
import uuid
from typing import TYPE_CHECKING, NamedTuple
import pytest
if TYPE_CHECKING:
from collections.abc import Iterable
f... | 112 | 3,395 |
conda | tests/plugins/subcommands/doctor/test_cli.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from __future__ import annotations
from typing import TYPE_CHECKING
from conda.base.context import context
from conda.exceptions import EnvironmentLocationNotFound
if TYPE_CHECKING:
from pytest_mock import MockerFixture
from conda.te... | 166 | 5,218 |
conda | tests/plugins/subcommands/doctor/health_checks/test_file_locking.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the file locking health check."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda.base.constants import OK_MARK, X_MARK
from conda.base.context import context, reset_context
from cond... | 56 | 1,515 |
conda | tests/plugins/subcommands/doctor/health_checks/test_environment_txt.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the environment.txt health check.
Note: env_ok fixture is defined in tests/plugins/subcommands/conftest.py
and shared with health fix tests.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from conda.base... | 85 | 2,808 |
conda | tests/plugins/subcommands/doctor/health_checks/test_consistency.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the environment consistency health check."""
from __future__ import annotations
from typing import TYPE_CHECKING
from conda.base.constants import OK_MARK, X_MARK
from conda.common.serialize import yaml
if TYPE_CHECKING:
from... | 87 | 2,916 |
conda | tests/plugins/subcommands/doctor/health_checks/__init__.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for doctor health checks."""
| 4 | 113 |
conda | tests/plugins/subcommands/doctor/health_checks/test_missing_files.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the missing files health check.
Note: env_ok, env_missing_files fixtures are defined in
tests/plugins/subcommands/conftest.py and shared with health fix tests.
"""
from __future__ import annotations
from typing import TYPE_CHECKI... | 54 | 1,843 |
conda | tests/plugins/subcommands/doctor/health_checks/test_altered_files.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the altered files health check.
Note: env_ok, env_altered_files fixtures are defined in
tests/plugins/subcommands/conftest.py and shared with health fix tests.
"""
from __future__ import annotations
import json
from typing import... | 85 | 2,836 |
conda | tests/plugins/subcommands/doctor/health_checks/test_pinned.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the pinned file format health check."""
from __future__ import annotations
from typing import TYPE_CHECKING
import pytest
from conda.base.constants import OK_MARK, PREFIX_PINNED_FILE, X_MARK
if TYPE_CHECKING:
from conda.tes... | 39 | 1,043 |
conda | tests/plugins/subcommands/doctor/health_checks/test_requests_ca_bundle.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for the REQUESTS_CA_BUNDLE health check.
Note: env_ok fixture is defined in tests/plugins/subcommands/conftest.py
and shared with health fix tests.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from request... | 75 | 2,347 |
conda | tests/plugins/data/test-plugin/test_plugin/success.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
# see tests.plugins.test_manager.test_load_entrypoints_success
# simulate a successful plugin
from conda import plugins
from conda.core.solve import Solver
@plugins.hookimpl
def conda_solvers():
"""The conda plugin hook implementation to l... | 16 | 438 |
conda | tests/plugins/reporter_backends/test_console.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from contextlib import nullcontext
from errno import EPIPE
from io import StringIO
from pathlib import Path
from types import SimpleNamespace
import pytest
from conda.exceptions import CondaError
from conda.plugins.reporter_backends.console im... | 353 | 11,431 |
conda | tests/plugins/reporter_backends/test_json.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
from conda.common.serialize import json
from conda.plugins.reporter_backends.json import (
JSONProgressBar,
JSONReporterRenderer,
JSONSpinner,
)
def test_json_handler():
"""
Tests the JSONReporterHandler ReporterHandler cla... | 74 | 2,225 |
conda | tests/_preview/env_setup/test_env_setup.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Tests for env-setup preview module constants."""
from __future__ import annotations
from conda._preview.env_setup import PREVIEW_LABEL
def test_preview_label():
"""PREVIEW_LABEL must match the kebab-case name used in context.preview."... | 13 | 363 |
conda | tests/_preview/env_setup/cli/test_main_install.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Integration tests for conda/_preview/env_setup/cli/main_install.py.
These tests verify that:
- When the env-setup preview is NOT enabled, `conda install` runs via the standard path.
- When the env-setup preview IS enabled, `conda install` is... | 53 | 1,770 |
conda | tests/_preview/env_setup/cli/test_main_create.py | .py | # Copyright (C) 2012 Anaconda, Inc
# SPDX-License-Identifier: BSD-3-Clause
"""Integration tests for conda/_preview/env_setup/cli/main_create.py.
These tests verify that:
- When the env-setup preview is NOT enabled, `conda create` runs via the standard path.
- When the env-setup preview IS enabled, `conda create` is ro... | 108 | 3,788 |
mamba | update_changelog.py | .py | # Script to update `CHANGELOG.md` in order to release any of the mamba packages
# Steps:
# 1. Run this script to update the root `CHANGELOG.md` file by providing the date of
# the last release as input (cf. last date shown at the top of the file for reference)
# or any other starting date that may be relevant for the... | 196 | 7,747 |
mamba | releaser.py | .py | # Script to release any of the mamba packages.
# This script has no cli parameters and only read info from the root changelog
# which must have been modified by executing `update_changelog.py`.
# Please refer to `update_changelog.py` for more info about the release process.
import copy
import datetime
import re
from v... | 210 | 6,857 |
mamba | version_scheme.py | .py | # Parses and validates the version scheme chosen for mamba versions.
# Specifically, we use a dot to separate pre-release names and use complete names for `alpha` and `beta`.
#
# See:
# - discussion in https://github.com/mamba-org/mamba/issues/3638
# - https://conda-forge.org/docs/maintainer/knowledge_base/#pre-relea... | 70 | 2,984 |
mamba | micromamba/tests/test_history.py | .py | import re
# Need to import everything to get fixtures
from .helpers import * # noqa: F403
from . import helpers
def test_history(tmp_home, tmp_root_prefix):
env_name = "myenv"
helpers.create("-n", env_name, "python=3.8")
helpers.install("-n", env_name, "xtl")
helpers.uninstall("-n", env_name, "xtl")... | 21 | 731 |
mamba | micromamba/tests/test_shell.py | .py | import json
import os
import platform
import shutil
import subprocess
import sys
from pathlib import Path, PureWindowsPath
import pytest
from . import helpers
def skip_if_shell_incompat(shell_type):
"""Skip test if ``shell_type`` is incompatible with the platform"""
plat_system = platform.system()
if (
... | 343 | 12,294 |
mamba | micromamba/tests/test_linking.py | .py | import json
import os
import platform
import sys
from pathlib import Path
import pytest
# Need to import everything to get fixtures
from .helpers import * # noqa: F403
from . import helpers
package_to_test = "xtensor"
file_in_package_to_test = "xtensor.hpp"
class TestLinking:
current_root_prefix = os.environ[... | 324 | 13,206 |
mamba | micromamba/tests/test_proxy.py | .py | import os
import shutil
import subprocess
import time
import urllib.parse
from pathlib import Path
import pytest
from . import helpers
__this_dir__ = Path(__file__).parent.resolve()
@pytest.fixture
def mitmdump_exe():
"""Get the path to the ``mitmdump`` executable.
If the executable is provided in a conda... | 118 | 3,793 |
mamba | micromamba/tests/test_update.py | .py | import os
import platform
import shutil
import sys
from pathlib import Path
import pytest
import yaml
# Need to import everything to get fixtures
from .helpers import * # noqa: F403
from . import helpers
env_yaml_content_pip_deps = """
channels:
- conda-forge
dependencies:
- pip
- pip:
- numpy
"""
@pytest.mark.... | 587 | 21,407 |
mamba | micromamba/tests/test_repoquery.py | .py | import platform
from pathlib import Path
import pytest
from . import helpers
@pytest.fixture
def yaml_env(tmp_prefix: Path) -> None:
helpers.install(
"--channel",
"conda-forge",
"yaml=0.2.5",
"pyyaml=6.0.0",
no_dry_run=True,
)
@pytest.mark.parametrize("shared_pkgs_d... | 642 | 25,238 |
mamba | micromamba/tests/test_remove.py | .py | import os
import platform
import subprocess
import time
from pathlib import Path
import pytest
# Need to import everything to get fixtures
from .helpers import * # noqa: F403
from . import helpers
__this_dir__ = Path(__file__).parent.resolve()
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
@p... | 317 | 12,220 |
mamba | micromamba/tests/test_run.py | .py | import os
import random
import shutil
import string
import subprocess
from sys import platform
import pytest
from .helpers import create, random_string, subprocess_run, umamba_run
common_simple_flags = ["", "-d", "--detach", "--clean-env"]
# -d/--detach are not available on Windows (see run.cpp)
common_simple_flags_... | 131 | 4,906 |
mamba | micromamba/tests/test_menuinst.py | .py | import os
import shutil
import sys
from pathlib import Path
import pytest
from .helpers import create, random_string, remove
if sys.platform.startswith("win"):
import menuinst
import win32com.client
class TestMenuinst:
root_prefix = os.environ["MAMBA_ROOT_PREFIX"]
current_prefix = os.environ["CONDA... | 121 | 4,214 |
mamba | micromamba/tests/test_config.py | .py | import os
import platform
import shutil
import subprocess
import textwrap
from pathlib import Path
import pytest
import yaml
from . import helpers
@pytest.fixture
def user_config_dir(tmp_home: Path):
"""Location of config files that are generated from mamba"""
maybe_xdg_config = os.getenv("XDG_CONFIG_DIR", ... | 807 | 30,052 |
mamba | micromamba/tests/test_prefix_interoperability.py | .py | """
Comprehensive test suite for prefix interoperability feature.
This test suite verifies that mamba correctly handles pip-installed packages
when prefix_data_interoperability is enabled, including:
- Configuration and enabling the feature
- Detecting pip packages
- Removing pip packages when conda packages are insta... | 694 | 28,024 |
mamba | micromamba/tests/test_completer.py | .py | import pytest
from . import helpers
def test_completer_lists_top_level_commands(tmp_home, tmp_root_prefix):
"""Regression: duplicate deactivate must not abort completer (CLI::OptionAlreadyAdded)."""
umamba = helpers.get_umamba()
out = helpers.subprocess_run(umamba, "completer", "").decode()
for comm... | 60 | 1,763 |
mamba | micromamba/tests/test_info.py | .py | import os
import pytest
from . import helpers
@pytest.mark.parametrize("prefix_selection", [None, "prefix", "name"])
def test_base(tmp_home, tmp_root_prefix, prefix_selection, monkeypatch):
monkeypatch.setenv("CONDA_PREFIX", str(tmp_root_prefix))
if prefix_selection == "prefix":
infos = helpers.inf... | 171 | 6,193 |
mamba | micromamba/tests/test_pkg_cache.py | .py | import os
import platform
import shutil
import subprocess
import glob
from pathlib import Path
from typing import Optional
import pytest
from . import helpers
package_to_check = "xtensor"
package_version_to_check = "0.27.0"
file_to_find_in_package = "xtensor.hpp"
def package_to_check_requirements():
return f"{... | 650 | 26,047 |
mamba | micromamba/tests/test_create.py | .py | import json
import os
import platform
import shutil
import subprocess
from pathlib import Path
from packaging.version import Version
import pytest
import yaml
from . import helpers
from memory_profiler import memory_usage
__this_dir__ = Path(__file__).parent.resolve()
def assert_explicit_envs_identical(src_explic... | 2,976 | 105,347 |
mamba | micromamba/tests/test_virtual_pkgs.py | .py | import os
import platform
from .helpers import info
class TestVirtualPkgs:
def test_virtual_packages(self):
infos = info()
assert "virtual packages :" in infos
assert "__archspec=1=" in infos
if platform.system() == "Windows":
assert "__win" in infos
elif plat... | 32 | 976 |
mamba | micromamba/tests/test_install.py | .py | import os
import platform
import shutil
import subprocess
import sys
from pathlib import Path
from packaging.version import Version
import pytest
import re
# Need to import everything to get fixtures
from .helpers import * # noqa: F403
from . import helpers
class TestInstall:
current_root_prefix = os.environ["... | 1,099 | 42,932 |
mamba | micromamba/tests/test_clean.py | .py | import os
import platform
from .helpers import * # noqa: F403
from . import helpers
def test_clean_all_removes_shard_cache(tmp_home, tmp_root_prefix):
cache_home = tmp_home / ".cache"
os.environ["XDG_CACHE_HOME"] = str(cache_home)
shard_cache_dir = cache_home / "conda" / "pkgs" / "cache" / "shards"
... | 139 | 5,327 |
mamba | micromamba/tests/test_login.py | .py | import base64
import json
import sys
from pathlib import Path
import pytest
from xprocess import ProcessStarter
from .helpers import create as umamba_create
from .helpers import login, logout, random_string
__this_dir__ = Path(__file__).resolve().parent
server_dir = __this_dir__ / "test-server"
pyserver = server_d... | 326 | 9,704 |
mamba | micromamba/tests/test_constructor.py | .py | """
Tests for micromamba constructor command.
Includes tests for:
- Basic package extraction
- URL-derived metadata handling (issue #4095)
- Consistent field presence (depends/constrains arrays)
"""
import glob
import hashlib
import json
import os
import shutil
import subprocess
import tarfile
from pathlib import Pat... | 375 | 14,347 |
mamba | micromamba/tests/helpers.py | .py | import errno
import json
import os
import platform
import random
import re
import shutil
import string
import subprocess
from enum import Enum
from pathlib import Path
import pytest
import yaml
def subprocess_run(*args: str, **kwargs) -> str:
"""Execute a command in a subprocess while properly capturing stderr i... | 733 | 23,265 |
mamba | micromamba/tests/test_package.py | .py | import filecmp
import platform
import shutil
import subprocess
import tarfile
import zipfile
from pathlib import Path
import pytest
import zstandard
from conda_package_handling import api as cph
from . import helpers
@pytest.fixture
def cph_test_file():
return Path(__file__).parent / "data" / "cph_test_data-0.0... | 196 | 6,113 |
mamba | micromamba/tests/test_list.py | .py | import platform
import subprocess
import sys
import pytest
import re
from . import helpers
@pytest.mark.parametrize("reverse_flag", ["", "--reverse"])
@pytest.mark.parametrize("quiet_flag", ["", "-q", "--quiet"])
@pytest.mark.parametrize("env_selector", ["", "name", "prefix"])
@pytest.mark.parametrize("shared_pkgs_... | 318 | 12,185 |
mamba | micromamba/tests/test_activation.py | .py | import os
import pathlib
import platform
import re
import shutil
import subprocess
import tempfile
from pathlib import Path, PurePosixPath, PureWindowsPath
import pytest
from . import helpers
plat, running_os = None, None
if platform.system() == "Linux":
plat = "linux"
running_os = "unix"
elif platform.syst... | 1,074 | 35,417 |
mamba | micromamba/tests/test_env.py | .py | import os
import re
import shutil
import subprocess
import platform
from packaging.version import Version
from pathlib import Path
import pytest
import yaml
from . import helpers
__this_dir__ = Path(__file__).parent.resolve()
def test_env_list(tmp_home, tmp_root_prefix, tmp_empty_env):
env_json = helpers.run_... | 1,031 | 38,469 |
mamba | micromamba/tests/dump_proxy_connections.py | .py | """
mitmproxy connection dumper plugin
This script shouldn't be run or imported directly. Instead, it should be passed to mitmproxy as a script (-s).
It will then dump all request urls in the file specified by the outfile option.
We use this script instead of letting mitmdump do the dumping, because we only care abou... | 38 | 1,130 |
mamba | micromamba/tests/conftest.py | .py | import copy
import os
import pathlib
import platform
from typing import Any, Optional
from collections.abc import Generator, Mapping
import pytest
from . import helpers
####################
# Config options #
####################
def pytest_addoption(parser):
"""Add command line argument to pytest."""
pa... | 195 | 6,400 |
mamba | micromamba/tests/test-server/reposerver.py | .py | import argparse
import base64
import os
import re
import sys
import http.server
class ChannelHandler(http.server.SimpleHTTPRequestHandler):
url_pattern = re.compile(r"^/(?:t/[^/]+/)?([^/]+)")
def do_GET(self) -> None:
# First extract channel name
channel_name = None
if tuple(channels.... | 193 | 6,145 |
mamba | micromamba/test-server/reposerver.py | .py | import argparse
import base64
import glob
import os
import re
import shutil
import sys
from http.server import HTTPServer, SimpleHTTPRequestHandler
from pathlib import Path
try:
import conda_content_trust.authentication as cct_authentication
import conda_content_trust.common as cct_common
import conda_cont... | 456 | 16,451 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.