Skip to content

Commit aa77804

Browse files
committed
Validate type-check for list-like
Signed-off-by: Uilian Ries <[email protected]>
1 parent a90fbd2 commit aa77804

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

test/unittests/client/toolchain/autotools/autotools_toolchain_test.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,9 @@ def test_conf_compiler_executable():
608608

609609

610610
def test_autotools_toolchain_conf_extra_configure_args():
611-
"""Validate that tools.gnu:extra_configure_args are passed to configure command only
611+
"""Validate that tools.gnu:extra_configure_args are passed to configure command only.
612+
613+
The configure args should be passed as list only.
612614
"""
613615
f = temp_folder()
614616
os.chdir(f)
@@ -623,3 +625,9 @@ def test_autotools_toolchain_conf_extra_configure_args():
623625
assert "--foo --bar" in obj["configure_args"]
624626
# make sure it does not forward to make
625627
assert "--foo" not in obj["make_args"]
628+
629+
conanfile.conf.define("tools.gnu:extra_configure_args", "--foo --bar")
630+
with pytest.raises(ConanException) as expected:
631+
AutotoolsToolchain(conanfile)
632+
assert "[conf] tools.gnu:extra_configure_args must be a list-like object. "\
633+
"The value '--foo --bar' introduced is a str object" in str(expected)

test/unittests/tools/gnu/test_gnutoolchain.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def test_crossbuild_to_android(build_env_mock):
240240
def test_gnu_toolchain_conf_extra_configure_args():
241241
""" Validate that tools.gnu:extra_configure_args are passed to the configure_args when
242242
building with GnuToolchain.
243+
The configure args should be passed as a list-like object.
243244
"""
244245
conanfile = ConanFileMock()
245246
conanfile.settings = MockSettings({"os": "Linux", "arch": "x86_64"})
@@ -249,3 +250,9 @@ def test_gnu_toolchain_conf_extra_configure_args():
249250
tc = GnuToolchain(conanfile)
250251
assert tc.configure_args["--foo"] is None
251252
assert tc.configure_args["--bar"] is None
253+
254+
conanfile.conf.define("tools.gnu:extra_configure_args", "--foo --bar")
255+
with pytest.raises(ConanException) as expected:
256+
GnuToolchain(conanfile)
257+
assert "[conf] tools.gnu:extra_configure_args must be a list-like object. " \
258+
"The value '--foo --bar' introduced is a str object" in str(expected)

0 commit comments

Comments
 (0)