|
| 1 | +import textwrap |
| 2 | + |
1 | 3 | import pytest
|
2 | 4 |
|
3 | 5 | from conan.test.utils.tools import TestClient
|
@@ -36,10 +38,29 @@ def test_auto_package_type(conanfile):
|
36 | 38 | c.run("graph info . --filter package_type")
|
37 | 39 | assert "package_type: static-library" in c.out
|
38 | 40 | c.run("graph info . --filter package_type -o shared=True")
|
| 41 | + assert "The package_type will have precedence over the options" not in c.out |
39 | 42 | assert "package_type: shared-library" in c.out
|
40 | 43 | c.run("graph info . --filter package_type -o shared=True -o header_only=False")
|
41 | 44 | assert "package_type: shared-library" in c.out
|
42 | 45 | c.run("graph info . --filter package_type -o header_only=True")
|
43 | 46 | assert "package_type: header-library" in c.out
|
44 | 47 | c.run("graph info . --filter package_type -o header_only=True -o shared=False")
|
45 | 48 | assert "package_type: header-library" in c.out
|
| 49 | + |
| 50 | +def test_package_type_and_header_library(): |
| 51 | + """ Show that forcing a package_type and header_only=True does not change the package_type""" |
| 52 | + tc = TestClient(light=True) |
| 53 | + tc.save({"conanfile.py": textwrap.dedent(""" |
| 54 | + from conan import ConanFile |
| 55 | +
|
| 56 | + class Pkg(ConanFile): |
| 57 | + package_type = "static-library" |
| 58 | + options = {"header_only": [True, False]} |
| 59 | +
|
| 60 | + """)}) |
| 61 | + tc.run("graph info . --filter package_type -o &:header_only=False") |
| 62 | + assert "package_type: static-library" in tc.out |
| 63 | + assert "The package_type will have precedence over the options" in tc.out |
| 64 | + tc.run("graph info . --filter package_type -o &:header_only=True") |
| 65 | + assert "package_type: static-library" in tc.out |
| 66 | + assert "The package_type will have precedence over the options" in tc.out |
0 commit comments