-
Notifications
You must be signed in to change notification settings - Fork 990
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
[develop2][poc] Checking the [system_tools]
idea
#10166
Merged
memsharded
merged 14 commits into
conan-io:develop2
from
memsharded:feature/develop2_deferred
Feb 15, 2023
Merged
Changes from 7 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
fa13694
playing with the deferred idea
memsharded 2e80a1d
Merge branch 'develop2' into feature/develop2_deferred
memsharded 376ec0f
adding tests
memsharded 1e5620a
adding package_id tests
memsharded 80d2dea
Merge branch 'develop2' into feature/develop2_deferred
memsharded 22d9594
test with deferred revisions
memsharded 7c2fb0d
reviewed, only tool_requires
memsharded a3d9fe1
wip
memsharded d87ab65
Merge branch 'develop2' into feature/develop2_deferred
memsharded 90ed3f0
wip
memsharded 1157eb8
wip
memsharded 317569a
wip
memsharded 68afe5e
Merge branch 'develop2' into feature/develop2_deferred
memsharded 2dcca79
test with lockfiles
memsharded File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,95 @@ | ||
import pytest | ||
|
||
from conans.test.assets.genconanfile import GenConanfile | ||
from conans.test.utils.tools import TestClient | ||
from conans.util.files import save | ||
|
||
|
||
class TestToolRequires: | ||
def test_deferred(self): | ||
client = TestClient() | ||
client.save({"conanfile.py": GenConanfile("pkg", "1.0").with_tool_requires("tool/1.0"), | ||
"profile": "[system_tool_requires]\ntool/1.0"}) | ||
client.run("create . -pr=profile") | ||
print(client.out) | ||
assert "tool/1.0 - System tool" in client.out | ||
|
||
def test_deferred_non_matching(self): | ||
""" if what is specified in [deferred] doesn't match what the recipe requires, then | ||
the deferred will not be used, and the recipe will use its declared version | ||
""" | ||
client = TestClient() | ||
client.save({"tool/conanfile.py": GenConanfile("tool", "1.0"), | ||
"conanfile.py": GenConanfile("pkg", "1.0").with_tool_requires("tool/1.0"), | ||
"profile": "[system_tool_requires]\ntool/1.1"}) | ||
client.run("create tool") | ||
client.run("create . -pr=profile") | ||
assert "tool/1.0#60ed6e65eae112df86da7f6d790887fd - Cache" in client.out | ||
|
||
def test_deferred_range(self): | ||
client = TestClient() | ||
client.save({"conanfile.py": GenConanfile("pkg", "1.0").with_tool_requires("tool/[>=1.0]"), | ||
"profile": "[system_tool_requires]\ntool/1.1"}) | ||
client.run("create . -pr=profile") | ||
assert "tool/1.1 - System tool" in client.out | ||
|
||
def test_deferred_range_non_matching(self): | ||
""" if what is specified in [deferred] doesn't match what the recipe requires, then | ||
the deferred will not be used, and the recipe will use its declared version | ||
""" | ||
client = TestClient() | ||
client.save({"tool/conanfile.py": GenConanfile("tool", "1.1"), | ||
"conanfile.py": GenConanfile("pkg", "1.0").with_tool_requires("tool/[>=1.0]"), | ||
"profile": "[system_tool_requires]\ntool/0.1"}) | ||
client.run("create tool") | ||
client.run("create . -pr=profile") | ||
assert "tool/1.1#888bda2348dd2ddcf5960d0af63b08f7 - Cache" in client.out | ||
|
||
|
||
class TestRequires: | ||
""" it works exactly the same for require requires | ||
""" | ||
def test_deferred(self): | ||
client = TestClient() | ||
client.save({"conanfile.py": GenConanfile("pkg", "1.0").with_requires("tool/1.0"), | ||
"profile": "[system_tool_requires]\ntool/1.0"}) | ||
client.run("create . -pr=profile", assert_error=True) | ||
assert "ERROR: Package 'tool/1.0' not resolved: No remote defined" in client.out | ||
|
||
|
||
class TestPackageID: | ||
""" if a consumer depends on recipe revision or package_id what happens | ||
""" | ||
|
||
@pytest.mark.parametrize("package_id_mode", ["recipe_revision_mode", "full_package_mode"]) | ||
def test_package_id_modes(self, package_id_mode): | ||
""" this test validates that the computation of the downstream consumers package_id | ||
doesnt break even if it depends on fields not existing in upstream deferred, like revision | ||
or package_id | ||
""" | ||
client = TestClient() | ||
save(client.cache.new_config_path, f"core.package_id:default_build_mode={package_id_mode}") | ||
client.save({"conanfile.py": GenConanfile("pkg", "1.0").with_tool_requires("dep/1.0"), | ||
"profile": "[system_tool_requires]\ndep/1.0"}) | ||
client.run("create . -pr=profile") | ||
assert "dep/1.0:da39a3ee5e6b4b0d3255bfef95601890afd80709 - System tool" in client.out | ||
|
||
def test_package_id_explicit_revision(self): | ||
""" | ||
Changing the deferred revision affects consumers if package_revision_mode=recipe_revision | ||
""" | ||
client = TestClient() | ||
save(client.cache.new_config_path, "core.package_id:default_build_mode=recipe_revision_mode") | ||
client.save({"conanfile.py": GenConanfile("pkg", "1.0").with_tool_requires("dep/1.0"), | ||
"profile": "[system_tool_requires]\ndep/1.0#r1", | ||
"profile2": "[system_tool_requires]\ndep/1.0#r2"}) | ||
client.run("create . -pr=profile") | ||
assert "dep/1.0#r1:da39a3ee5e6b4b0d3255bfef95601890afd80709 - System tool" in client.out | ||
assert "pkg/1.0#27a56f09310cf1237629bae4104fe5bd:" \ | ||
"ea0e320d94b4b70fcb3efbabf9ab871542f8f696 - Build" in client.out | ||
|
||
client.run("create . -pr=profile2") | ||
# pkg gets a new package_id because it is a different revision | ||
assert "dep/1.0#r2:da39a3ee5e6b4b0d3255bfef95601890afd80709 - System tool" in client.out | ||
assert "pkg/1.0#27a56f09310cf1237629bae4104fe5bd:" \ | ||
"334882884da082740e5a002a0b6fdb509a280159 - Build" in client.out |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All this part doesnt change, just putting it inside the
if resolved is None