Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new layout() test for projects sharing common code in parent fold…
…ers (#11556) * test layout sharing code * added cmake_layout subfolder * fix test * using self.folders.subproject approach * fix test Linux * Update conans/model/layout.py Co-authored-by: Luis Martinez <lasote@gmail.com> Co-authored-by: Luis Martinez <lasote@gmail.com>
- Loading branch information
1 parent
fae0b53
commit 3b84d99
Showing
8 changed files
with
180 additions
and
11 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
Empty file.
25 changes: 25 additions & 0 deletions
25
conans/test/integration/toolchains/gnu/test_basic_layout.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,25 @@ | ||
import os | ||
import platform | ||
import textwrap | ||
|
||
from conans.test.utils.tools import TestClient | ||
|
||
|
||
def test_basic_layout_subproject(): | ||
c = TestClient() | ||
conanfile = textwrap.dedent(""" | ||
from conan import ConanFile | ||
from conan.tools.layout import basic_layout | ||
class Pkg(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "AutotoolsToolchain" | ||
def layout(self): | ||
self.folders.root = ".." | ||
self.folders.subproject = "pkg" | ||
basic_layout(self) | ||
""") | ||
c.save({"pkg/conanfile.py": conanfile}) | ||
c.run("install pkg") | ||
ext = "sh" if platform.system() != "Windows" else "bat" | ||
assert os.path.isfile(os.path.join(c.current_folder, "pkg", "build-release", "conan", | ||
"conanautotoolstoolchain.{}".format(ext))) |
22 changes: 22 additions & 0 deletions
22
conans/test/integration/toolchains/microsoft/test_vs_layout.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,22 @@ | ||
import os | ||
import textwrap | ||
|
||
from conans.test.utils.tools import TestClient | ||
|
||
|
||
def test_vs_layout_subproject(): | ||
c = TestClient() | ||
conanfile = textwrap.dedent(""" | ||
from conan import ConanFile | ||
from conan.tools.microsoft import vs_layout | ||
class Pkg(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "MSBuildToolchain" | ||
def layout(self): | ||
self.folders.root = ".." | ||
self.folders.subproject = "pkg" | ||
vs_layout(self) | ||
""") | ||
c.save({"pkg/conanfile.py": conanfile}) | ||
c.run("install pkg") | ||
assert os.path.isfile(os.path.join(c.current_folder, "pkg", "conan", "conantoolchain.props")) |