Skip to content

Commit

Permalink
readd tests for grayskull too
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp committed Apr 4, 2024
1 parent 1e92243 commit 194e8e7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
11 changes: 10 additions & 1 deletion conda_pip/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@


def configure_parser(parser: argparse.ArgumentParser):
from .dependencies import BACKENDS

add_parser_help(parser)
add_parser_prefix(parser)
add_output_and_prompt_options(parser)
Expand Down Expand Up @@ -51,6 +53,13 @@ def configure_parser(parser: argparse.ArgumentParser):
default="conda-forge",
help="Where to look for conda dependencies.",
)
install.add_argument(
"--backend",
metavar="TOOL",
default="pip",
choices=BACKENDS,
help="Which tool to use for PyPI packaging dependency resolution.",
)
install.add_argument("packages", metavar="package", nargs="+")


Expand All @@ -74,7 +83,7 @@ def execute(args: argparse.Namespace) -> None:
*packages_to_process,
prefer_on_conda=not args.force_with_pip,
channel=args.conda_channel,
backend="pip",
backend=args.backend,
prefix=prefix,
)

Expand Down
4 changes: 4 additions & 0 deletions conda_pip/dependencies/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@

logger = getLogger(f"conda.{__name__}")

BACKENDS = (
"grayskull",
"pip",
)

def analyze_dependencies(
*packages: str,
Expand Down
6 changes: 5 additions & 1 deletion tests/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
from conda.testing import CondaCLIFixture, TmpEnvFixture
from conda.testing.integration import package_is_installed

from conda_pip.dependencies import BACKENDS

@pytest.mark.parametrize("backend", BACKENDS)
@pytest.mark.parametrize("spec", ["numpy", "numpy=1.20"])
def test_conda_pip_install_numpy(tmp_env: TmpEnvFixture, conda_cli: CondaCLIFixture, spec: str):
def test_conda_pip_install_numpy(tmp_env: TmpEnvFixture, conda_cli: CondaCLIFixture, spec: str, backend: str):
with tmp_env("python=3.9", "pip") as prefix:
out, err, rc = conda_cli(
"pip",
"-p",
prefix,
"--yes",
"install",
"--backend",
backend,
spec,
)
print(out)
Expand Down

0 comments on commit 194e8e7

Please sign in to comment.