Skip to content

Commit

Permalink
Split tests
Browse files Browse the repository at this point in the history
  • Loading branch information
atugushev committed Jul 1, 2023
1 parent 006e94a commit 65fe40f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
12 changes: 9 additions & 3 deletions tests/test_cli_compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2972,12 +2972,18 @@ def test_config_option(pip_conf, runner, tmp_path, make_config_file):
out = runner.invoke(cli, [req_in.as_posix(), "--config", config_file.as_posix()])

assert out.exit_code == 0
dry_run_message = "Dry-run, so nothing updated"
assert dry_run_message in out.stderr
assert "Dry-run, so nothing updated" in out.stderr


def test_no_config_option(pip_conf, runner, tmp_path, make_config_file):
config_file = make_config_file("dry-run", True)

req_in = tmp_path / "requirements.in"
req_in.touch()

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

assert out.exit_code == 0
assert dry_run_message not in out.stderr
assert "Dry-run, so nothing updated" not in out.stderr
13 changes: 10 additions & 3 deletions tests/test_cli_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,17 @@ def test_config_option(run, runner, make_config_file):
out = runner.invoke(cli, ["--config", config_file.as_posix()])

assert out.exit_code == 1
dry_run_message = "Would install:"
assert dry_run_message in out.stdout
assert "Would install:" in out.stdout


@mock.patch("piptools.sync.run")
def test_no_config_option(run, runner, make_config_file):
config_file = make_config_file("dry-run", True)

with open(sync.DEFAULT_REQUIREMENTS_FILE, "w") as reqs_txt:
reqs_txt.write("six==1.10.0")

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

assert out.exit_code == 0
assert dry_run_message not in out.stdout
assert "Would install:" not in out.stdout

0 comments on commit 65fe40f

Please sign in to comment.