forked from python-poetry/poetry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves: python-poetry#2789
- Loading branch information
Showing
9 changed files
with
157 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
import re | ||
|
||
import pytest | ||
|
||
from tests.helpers import get_package | ||
|
||
|
||
@pytest.fixture | ||
def command_tester_with_build_requires( | ||
repo, make_poetry, make_installer_command_tester | ||
): | ||
repo.add_package(get_package("cython", "0.29.6")) | ||
poetry = make_poetry("project_with_build_system_requires") | ||
return make_installer_command_tester(poetry, "build") | ||
|
||
|
||
@pytest.fixture | ||
def command_tester(project_directory, make_poetry, make_installer_command_tester): | ||
return make_installer_command_tester(make_poetry(project_directory), "build") | ||
|
||
|
||
def test_build_project_complete(command_tester): | ||
tester = command_tester | ||
command_tester.execute() | ||
|
||
assert tester._command.installer.executor.installations_count == 0 | ||
|
||
output = tester.io.fetch_output() | ||
|
||
assert "Writing lock file" not in output | ||
assert "Building sdist" in output | ||
assert "Built simple-project-1.2.3.tar.gz" in output | ||
assert "Building wheel" in output | ||
assert re.search(r"Built simple_project-1\.2\.3-.*\.whl", output) is not None | ||
|
||
|
||
def test_build_project_sdist(command_tester): | ||
tester = command_tester | ||
command_tester.execute("-f sdist") | ||
|
||
assert tester._command.installer.executor.installations_count == 0 | ||
|
||
output = tester.io.fetch_output() | ||
|
||
assert "Writing lock file" not in output | ||
assert "Building sdist" in output | ||
assert "Built simple-project-1.2.3.tar.gz" in output | ||
assert "Building wheel" not in output | ||
assert re.search(r"Built simple_project-1\.2\.3-.*\.whl", output) is None | ||
|
||
|
||
def test_build_project_wheel(command_tester): | ||
tester = command_tester | ||
command_tester.execute("-f wheel") | ||
|
||
assert tester._command.installer.executor.installations_count == 0 | ||
|
||
output = tester.io.fetch_output() | ||
|
||
assert "Writing lock file" not in output | ||
assert "Building sdist" not in output | ||
assert "Built simple-project-1.2.3.tar.gz" not in output | ||
assert "Building wheel" in output | ||
assert re.search(r"Built simple_project-1\.2\.3-.*\.whl", output) is not None | ||
|
||
|
||
def test_build_project_with_build_requires(command_tester_with_build_requires): | ||
tester = command_tester_with_build_requires | ||
tester.execute() | ||
|
||
assert tester._command.installer.executor.installations_count == 1 | ||
|
||
package = tester._command.installer.executor._installs[0] | ||
assert package.name == "cython" | ||
assert package.version.text == "0.29.6" | ||
|
||
output = tester.io.fetch_output() | ||
|
||
assert "Writing lock file" in output | ||
assert "Building sdist" in output | ||
assert "Built project-1.2.3.tar.gz" in output | ||
assert "Building wheel" in output | ||
assert re.search(r"Built project-1\.2\.3-.*\.whl", output) is not None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
My Package | ||
========== |
Empty file.
Empty file.
19 changes: 19 additions & 0 deletions
19
tests/fixtures/project_with_build_system_requires/pyproject.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[tool.poetry] | ||
name = "project" | ||
version = "1.2.3" | ||
description = "Some description." | ||
authors = [] | ||
license = "MIT" | ||
|
||
[tool.poetry.build] | ||
script = "build.py" | ||
generate-setup-file = false | ||
|
||
[tool.poetry.dependencies] | ||
python = "^3.7" | ||
|
||
[build-system] | ||
requires = [ | ||
"poetry-core", | ||
"Cython>=0.29.6", | ||
] |