Skip to content
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

Removing warnings from test suite #17670

Merged
merged 4 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/actions/test-coverage/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
duration:
description: 'Tests maximum duration'
required: true
default: '20'
default: '10'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More than enough, we very rarely see them or use slowest tests info from here to optimize them


tests:
description: 'Tests folder and options to run'
Expand Down
2 changes: 2 additions & 0 deletions conan/test/utils/file_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@


class TestFileServer:
__test__ = False

def __init__(self, store=None):
self.store = store or temp_folder(path_with_spaces=False)
mkdir(self.store)
Expand Down
4 changes: 3 additions & 1 deletion conan/test/utils/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,9 @@ def codes(self):
return requests.codes


class TestServer(object):
class TestServer:
__test__ = False

def __init__(self, read_permissions=None,
write_permissions=None, users=None, plugins=None, base_path=None,
server_capabilities=None, complete_urls=False):
Expand Down
4 changes: 3 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[pytest]
norecursedirs = '.*', 'dist', 'CVS', '_darcs', '{arch}', '*.egg', 'venv', 'assets'
testpaths = 'test'
markers = docker_runner: Mark tests that require Docker to run.
markers =
docker_runner: Mark tests that require Docker to run.
artifactory_ready: These tests can be run against a full Artifactory
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from conan.test.utils.tools import TestClient


@pytest.mark.slow
@pytest.mark.tool("cmake")
@pytest.fixture(scope="module")
def setup_client_with_greetings():
Expand Down Expand Up @@ -433,7 +432,6 @@ def test_no_components(setup_client_with_greetings):
create_chat(client, "none", package_info, cmake_find, test_cmake_find)


@pytest.mark.slow
@pytest.mark.tool("cmake")
def test_same_names():
client = TestClient()
Expand Down Expand Up @@ -621,7 +619,6 @@ def package_info(self):
client.run("install consumer.py", assert_error=True)
assert "Component 'mypkg::zlib' not found in 'mypkg' package requirement" in client.out

@pytest.mark.slow
def test_same_name_global_target_collision(self):
# https://github.com/conan-io/conan/issues/7889
conanfile_tpl = textwrap.dedent("""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def _get_link_order_from_xcode(content):
libs = []

# Find the right Release block in the XCode file
results = re.finditer('/\* Release \*/ = {', content)
results = re.finditer(r'/\* Release \*/ = {', content)
for r in results:
release_section = content[r.start():].split("name = Release;", 1)[0]
if "-headerpad_max_install_names" in release_section:
Expand Down
2 changes: 1 addition & 1 deletion test/functional/toolchains/cmake/test_cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ def build(self):
cmake = CMake(self)
cmake.configure()
cmake.build()
self.run("Release\\myapp.exe")
self.run(r"Release\\myapp.exe")
""")
cmakelists = gen_cmakelists(appname="myapp", appsources=["app.cpp"])
main = gen_function_cpp(name="main")
Expand Down
1 change: 0 additions & 1 deletion test/functional/toolchains/microsoft/test_msbuilddeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@
@pytest.mark.skipif(platform.system() != "Windows", reason="Requires MSBuild")
class MSBuildGeneratorTest(unittest.TestCase):

@pytest.mark.slow
@pytest.mark.tool("cmake")
def test_msbuild_generator(self):
client = TestClient()
Expand Down
38 changes: 38 additions & 0 deletions test/integration/configuration/test_profile_jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,3 +269,41 @@ def test_profile_jinja_error():
c.save({"profile1": "{% set kk = other() %}"})
c.run("profile show -pr=profile1", assert_error=True)
assert "ERROR: Error while rendering the profile template file" in c.out


def test_profile_macro_per_package():
client = TestClient()
tpl1 = textwrap.dedent("""
{% macro set_windows_settings(lib) %}
{{lib}}/*:os=Windows
{{lib}}/*:arch=x86
{% endmacro %}
{% macro set_windows_conf(lib) %}
{{lib}}/*:user.conf:key = 2
{% endmacro %}

[settings]
os = Linux
{{set_windows_settings("mypkg")}}
[conf]
user.conf:key = 1
{{set_windows_conf("mypkg")}}
""")
conanfile = textwrap.dedent("""
from conan import ConanFile
class Pkg(ConanFile):
name = "mypkg"
version = "0.1"
settings = "os", "arch"
def generate(self):
value = self.conf.get("user.conf:key")
self.output.info(f"os={self.settings.os}!!")
self.output.info(f"arch={self.settings.arch}!!")
self.output.info(f"user.conf:key={value}!!!!")
""")
client.save({"conanfile.py": conanfile,
"profile1": tpl1})
client.run("install . -pr=profile1")
assert "conanfile.py (mypkg/0.1): user.conf:key=2!!!!" in client.out
assert "conanfile.py (mypkg/0.1): os=Windows!!" in client.out
assert "conanfile.py (mypkg/0.1): arch=x86!!" in client.out
Loading