forked from conan-io/conan
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test_requires shouldn't affect package_id (conan-io#13966)
* test_requires shouldn't affect package_id * test with transitive * remove prints
- Loading branch information
1 parent
ad22ad3
commit d3d9fbf
Showing
2 changed files
with
42 additions
and
1 deletion.
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
39 changes: 39 additions & 0 deletions
39
conans/test/integration/package_id/test_package_id_test_requires.py
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,39 @@ | ||
import pytest | ||
|
||
from conans.test.utils.tools import GenConanfile, TestClient | ||
from conans.util.files import save | ||
|
||
|
||
@pytest.mark.parametrize("build_mode", [None, "patch_mode"]) | ||
def test_package_id_not_affected_test_requires(build_mode): | ||
""" | ||
By default, test_requires do not affect the package_id | ||
""" | ||
c = TestClient() | ||
if build_mode is not None: | ||
save(c.cache.new_config_path, "core.package_id:default_build_mode={build_mode}") | ||
c.save({"gtest/conanfile.py": GenConanfile("gtest", "1.0"), | ||
"engine/conanfile.py": GenConanfile("engine", "1.0").with_test_requires("gtest/1.0")}) | ||
c.run("create gtest") | ||
c.run("create engine") | ||
c.run("list engine:*") | ||
assert "engine/1.0" in c.out | ||
assert "gtest" not in c.out | ||
|
||
|
||
def test_package_id_not_affected_test_requires_transitive(): | ||
""" | ||
By default, transitive deps of test_requires do not affect the package_id | ||
""" | ||
c = TestClient() | ||
|
||
c.save({"zlib/conanfile.py": GenConanfile("zlib", "1.0"), | ||
"gtest/conanfile.py": GenConanfile("gtest", "1.0").with_requires("zlib/1.0"), | ||
"engine/conanfile.py": GenConanfile("engine", "1.0").with_test_requires("gtest/1.0")}) | ||
c.run("create zlib") | ||
c.run("create gtest") | ||
c.run("create engine") | ||
c.run("list engine:*") | ||
assert "engine/1.0" in c.out | ||
assert "gtest" not in c.out | ||
assert "zlib" not in c.out |