Skip to content

Commit

Permalink
add two tests
Browse files Browse the repository at this point in the history
  • Loading branch information
csalerno-asml committed Jan 17, 2024
1 parent 545c643 commit 7d1393d
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/pip-tools
Submodule pip-tools added at f97e62
41 changes: 41 additions & 0 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3447,6 +3447,47 @@ def test_allow_in_config_pip_sync_option(pip_conf, runner, tmp_path, make_config
assert "Using pip-tools configuration defaults found" in out.stderr


def test_use_src_files_from_config_if_option_is_not_specified_from_cli(pip_conf, runner, tmp_path, make_config_file):
foo_in = tmp_path / "foo.in"
req_in = tmp_path / "requirements.in"

config_file = make_config_file("src-files", [foo_in.as_posix()])

with open(req_in, "w") as f:
f.write("small-fake-a==0.1")

with open(foo_in, "w") as f:
f.write("small-fake-b==0.1")

out = runner.invoke(
cli, ["--config", config_file.as_posix()]
)

assert out.exit_code == 0
assert "small-fake-b" in out.stderr
assert "small-fake-a" not in out.stderr


def test_use_src_files_from_cli_if_option_is_specified_in_both_config_and_cli(pip_conf, runner, tmp_path, make_config_file):
foo_in = tmp_path / "foo.in"
req_in = tmp_path / "requirements.in"

config_file = make_config_file("src-files", [foo_in.as_posix()])

with open(req_in, "w") as f:
f.write("small-fake-a==0.1")

with open(foo_in, "w") as f:
f.write("small-fake-b==0.1")

out = runner.invoke(
cli, [req_in.as_posix(), "--config", config_file.as_posix()]
)

assert out.exit_code == 0
assert "small-fake-a" in out.stderr
assert "small-fake-b" not in out.stderr

def test_cli_boolean_flag_config_option_has_valid_context(
pip_conf, runner, tmp_path, make_config_file
):
Expand Down

0 comments on commit 7d1393d

Please sign in to comment.