Skip to content

Commit c0ef44d

Browse files
authored
Fix runners after refactor on #17961 (#18040)
Changelog: omit Docs: omit This PR fixes two issues related with conan runners: 1. An error introduced in #17961 where an invalid runner instance were being returned instead of a runner class 2. Make runner tests run again in GitHub actions. This PR #17839 forced the github job to use a custom docker image instead which does not have enabled docker in docker feature, making pytest to skip all the conan runner tests
2 parents 562ffcc + 8c539cb commit c0ef44d

File tree

3 files changed

+16
-19
lines changed

3 files changed

+16
-19
lines changed

.github/workflows/linux-tests.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ jobs:
9696
linux_docker_tests:
9797
needs: build_container
9898
runs-on: ubuntu-latest
99-
container:
100-
image: ghcr.io/${{ github.repository_owner }}/conan-tests:${{ needs.build_container.outputs.image_tag }}
101-
options: --user conan
10299
strategy:
103100
matrix:
104101
# Use modern versions due to docker incompatibility with python <3.8
@@ -110,9 +107,9 @@ jobs:
110107
uses: actions/checkout@v4
111108

112109
- name: Set up Python ${{ matrix.python-version }}
113-
run: |
114-
pyenv global ${{ matrix.python-version }}
115-
python --version
110+
uses: actions/setup-python@v5
111+
with:
112+
python-version: ${{ matrix.python-version }}
116113

117114
- name: Cache pip
118115
uses: actions/cache@v4

conan/api/subapi/command.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,4 @@ def get_runner(profile_host):
5959
except KeyError:
6060
raise ConanException(f"Invalid runner type '{runner_type}'. "
6161
f"Allowed values: {', '.join(runner_instances_map.keys())}")
62-
return runner_instance(profile_host.runner)
62+
return runner_instance

test/functional/command/runner_test.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from conan.test.assets.sources import gen_function_h, gen_function_cpp
88

99

10-
def docker_skip(test_image=None):
10+
def docker_skip(test_image='ubuntu:22.04'):
1111
try:
1212
try:
1313
docker_client = docker.from_env()
@@ -37,7 +37,7 @@ def dockerfile_path(name=None):
3737

3838

3939
@pytest.mark.docker_runner
40-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
40+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
4141
def test_create_docker_runner_cache_shared():
4242
"""
4343
Tests the ``conan create . ``
@@ -81,7 +81,7 @@ def test_create_docker_runner_cache_shared():
8181

8282

8383
@pytest.mark.docker_runner
84-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
84+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
8585
def test_create_docker_runner_cache_shared_profile_from_cache():
8686
"""
8787
Tests the ``conan create . ``
@@ -125,7 +125,7 @@ def test_create_docker_runner_cache_shared_profile_from_cache():
125125

126126

127127
@pytest.mark.docker_runner
128-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
128+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
129129
def test_create_docker_runner_cache_shared_profile_folder():
130130
"""
131131
Tests the ``conan create . ``
@@ -169,7 +169,7 @@ def test_create_docker_runner_cache_shared_profile_folder():
169169
assert "Removing container" in client.out
170170

171171
@pytest.mark.docker_runner
172-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
172+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
173173
def test_create_docker_runner_dockerfile_folder_path():
174174
"""
175175
Tests the ``conan create . ``
@@ -240,7 +240,7 @@ def test_create_docker_runner_dockerfile_folder_path():
240240

241241

242242
@pytest.mark.docker_runner
243-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
243+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
244244
def test_create_docker_runner_profile_default_folder():
245245
"""
246246
Tests the ``conan create . ``
@@ -286,7 +286,7 @@ def test_create_docker_runner_profile_default_folder():
286286

287287

288288
@pytest.mark.docker_runner
289-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
289+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
290290
def test_create_docker_runner_dockerfile_file_path():
291291
"""
292292
Tests the ``conan create . ``
@@ -331,7 +331,7 @@ def test_create_docker_runner_dockerfile_file_path():
331331

332332

333333
@pytest.mark.docker_runner
334-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
334+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
335335
@pytest.mark.parametrize("build_type,shared", [("Release", False), ("Debug", True)])
336336
def test_create_docker_runner_with_ninja(build_type, shared):
337337
conanfile = textwrap.dedent("""
@@ -396,7 +396,7 @@ def package(self):
396396
assert "main: {}!".format(build_type) in client.out
397397

398398
@pytest.mark.docker_runner
399-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
399+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
400400
def test_create_docker_runner_from_configfile():
401401
"""
402402
Tests the ``conan create . ``
@@ -451,7 +451,7 @@ def test_create_docker_runner_from_configfile():
451451

452452

453453
@pytest.mark.docker_runner
454-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
454+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
455455
def test_create_docker_runner_from_configfile_with_args():
456456
"""
457457
Tests the ``conan create . ``
@@ -515,7 +515,7 @@ def test_create_docker_runner_from_configfile_with_args():
515515
docker_client.networks.get("my-network").remove()
516516

517517
@pytest.mark.docker_runner
518-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
518+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
519519
def test_create_docker_runner_default_build_profile():
520520
"""
521521
Tests the ``conan create . ``
@@ -552,7 +552,7 @@ def test_create_docker_runner_default_build_profile():
552552

553553

554554
@pytest.mark.docker_runner
555-
@pytest.mark.skipif(docker_skip('ubuntu:22.04'), reason="Only docker running")
555+
@pytest.mark.skipif(docker_skip(), reason="Only docker running")
556556
def test_create_docker_runner_in_subfolder():
557557
client = TestClient()
558558
conanfile = textwrap.dedent("""

0 commit comments

Comments
 (0)