Skip to content

Commit

Permalink
Make tests depend on custom target
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTereshenkov committed Apr 18, 2024
1 parent 91b1cf5 commit c985a7e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 43 deletions.
2 changes: 1 addition & 1 deletion BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ python_distribution(
dependencies=[
":setup-py",
":MANIFEST",
"cheeseshop:project-version",
#"cheeseshop:project-version",
"cheeseshop/cli:cheeseshop-query",
],
provides=python_artifact(
Expand Down
10 changes: 5 additions & 5 deletions cheeseshop/BUILD
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
python_sources()

resource(
name="project-version",
source="VERSION",
)
#
#resource(
# name="project-version",
# source="VERSION",
#)

version_file(
name="main-project-version",
Expand Down
2 changes: 1 addition & 1 deletion cheeseshop/cli/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ pex_binary(

python_sources(
name="cli",
dependencies=["cheeseshop:project-version"],
#dependencies=["cheeseshop:project-version"],
)
3 changes: 2 additions & 1 deletion tests/cli/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
python_tests(
name="tests",
dependencies=[
"cheeseshop:project-version",
#"cheeseshop:project-version",
"cheeseshop:main-project-version",
":cassettes",
],
)
Expand Down
36 changes: 1 addition & 35 deletions tests/cli/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,4 @@
import pytest
from click.testing import CliRunner

from cheeseshop.cli import cli
from cheeseshop.version import VERSION


def test_cli():
runner = CliRunner()
result = runner.invoke(cli.cli, ["--version"])
assert result.exit_code == 0
assert VERSION in result.output


@pytest.mark.vcr()
def test_cli_info():
runner = CliRunner()
result = runner.invoke(cli.cli, ["info", "--package", "packaging"])
assert result.exit_code == 0
assert "Core utilities for Python packages" in result.output


@pytest.mark.vcr()
def test_cli_list_versions():
runner = CliRunner()
result = runner.invoke(
cli.cli,
[
"list-versions",
"--package=numpy",
"--python-version=cp38",
"--package-type=bdist_wheel",
"--platform=macos",
"--arch=x86_64",
],
)
assert result.exit_code == 0
assert "numpy==1.17.3" in result.output
assert True

0 comments on commit c985a7e

Please sign in to comment.