Skip to content

Commit

Permalink
Integration test for merging requirements without names
Browse files Browse the repository at this point in the history
  • Loading branch information
richafrank committed Feb 2, 2023
1 parent 7c2a0bd commit 5b86448
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/test_cli_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import subprocess
import sys
from pathlib import Path
from unittest import mock

import pytest
Expand Down Expand Up @@ -128,6 +129,31 @@ def test_merge_error(req_lines, should_raise, runner):
assert out.exit_code == 1


@pytest.mark.parametrize(
"req_line",
(
"file:.",
"-e file:.",
),
)
@mock.patch("piptools.sync.run")
def test_merge_no_name_urls(run, req_line, runner):
"""
Test sync succeeds when merging requirements that lack names.
"""
reqs_paths = [
Path(name).absolute() for name in ("requirements.txt", "dev_requirements.txt")
]

for reqs_path in reqs_paths:
with reqs_path.open("w") as req_out:
req_out.write(f"{req_line} \n")

out = runner.invoke(cli, [str(path) for path in reqs_paths])
assert out.exit_code == 0
assert run.call_count == 2


@pytest.mark.parametrize(
("cli_flags", "expected_install_flags"),
(
Expand Down

0 comments on commit 5b86448

Please sign in to comment.