Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix failing tests #1

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
68 changes: 38 additions & 30 deletions tests/test_cli_compile.py
Expand Up @@ -39,17 +39,8 @@ def test_command_line_overrides_pip_conf(pip_with_index_conf, runner):
assert "Using indexes:\n http://override.com" in out.stderr


def test_command_line_setuptools_read(make_pip_conf, runner):
make_pip_conf(
dedent(
f"""\
[global]
disable-pip-version-check = True
find-links = {MINIMAL_WHEELS_PATH}
"""
)
)

@pytest.mark.network
def test_command_line_setuptools_read(runner):
with open("setup.py", "w") as package:
package.write(
dedent(
Expand All @@ -62,16 +53,13 @@ def test_command_line_setuptools_read(make_pip_conf, runner):
"""
)
)
out = runner.invoke(cli, ["--no-emit-find-links"])
out = runner.invoke(
cli,
["--no-header", "--no-emit-find-links", "--find-links", MINIMAL_WHEELS_PATH],
)

assert out.stderr == dedent(
"""\
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --no-emit-find-links
#
small-fake-a==0.1
# via fake-setuptools-a (setup.py)
"""
Expand All @@ -81,6 +69,7 @@ def test_command_line_setuptools_read(make_pip_conf, runner):
assert os.path.exists("requirements.txt")


@pytest.mark.network
@pytest.mark.parametrize(
("options", "expected_output_file"),
(
Expand All @@ -96,20 +85,10 @@ def test_command_line_setuptools_read(make_pip_conf, runner):
(["setup.py", "--output-file", "output.txt"], "output.txt"),
),
)
def test_command_line_setuptools_output_file(
make_pip_conf, runner, options, expected_output_file
):
def test_command_line_setuptools_output_file(runner, options, expected_output_file):
"""
Test the output files for setup.py as a requirement file.
"""
make_pip_conf(
dedent(
f"""\
[global]
find-links = {MINIMAL_WHEELS_PATH}
"""
)
)

with open("setup.py", "w") as package:
package.write(
Expand All @@ -126,7 +105,8 @@ def test_command_line_setuptools_output_file(
assert os.path.exists(expected_output_file)


def test_command_line_setuptools_nested_output_file(pip_conf, tmpdir, runner):
@pytest.mark.network
def test_command_line_setuptools_nested_output_file(tmpdir, runner):
"""
Test the output file for setup.py in nested folder as a requirement file.
"""
Expand All @@ -147,6 +127,34 @@ def test_command_line_setuptools_nested_output_file(pip_conf, tmpdir, runner):
assert (proj_dir / "requirements.txt").exists()


@pytest.mark.network
def test_setuptools_preserves_environment_markers(
runner, make_package, make_wheel, tmpdir
):
dists_dir = tmpdir / "dists"

foo_dir = make_package(name="foo", version="1.0")
make_wheel(foo_dir, dists_dir)

bar_dir = make_package(
name="bar", version="2.0", install_requires=['foo ; python_version >= "1"']
)
out = runner.invoke(
cli,
[
str(bar_dir / "setup.py"),
"--no-header",
"--no-annotate",
"--no-emit-find-links",
"--find-links",
str(dists_dir),
],
)

assert out.exit_code == 0, out.stderr
assert out.stderr == 'foo==1.0 ; python_version >= "1"\n'


def test_find_links_option(runner):
with open("requirements.in", "w") as req_in:
req_in.write("-f ./libs3")
Expand Down