File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111from cppython .plugins .conan .schema import ConanDependency
1212
1313
14+ @pytest .fixture (autouse = True )
15+ def clean_conan_cache (tmp_path : Path , monkeypatch : pytest .MonkeyPatch ):
16+ """Sets CONAN_HOME to a temporary directory for each test.
17+
18+ This ensures all tests run with a clean Conan cache.
19+
20+ Args:
21+ tmp_path: Pytest temporary directory fixture
22+ monkeypatch: Pytest monkeypatch fixture for environment variable manipulation
23+ """
24+ conan_home = tmp_path / 'conan_home'
25+ conan_home .mkdir ()
26+
27+ # Set CONAN_HOME to the temporary directory
28+ monkeypatch .setenv ('CONAN_HOME' , str (conan_home ))
29+
30+
1431@pytest .fixture (name = 'conan_mock_api' )
1532def fixture_conan_mock_api (mocker : MockerFixture ) -> Mock :
1633 """Creates a mock ConanAPI instance for install/update operations
Original file line number Diff line number Diff line change 1414from cppython .core .schema import ProjectConfiguration
1515from cppython .project import Project
1616
17- pytest_plugins = ['tests.fixtures.example' ]
17+ pytest_plugins = ['tests.fixtures.example' , 'tests.fixtures.conan' ]
1818
1919
2020class TestConanCMake :
@@ -49,3 +49,5 @@ def test_simple(example_runner: CliRunner) -> None:
4949
5050 # Verify that the build directory contains the expected files
5151 assert (path / 'CMakeCache.txt' ).exists (), f'{ path / "CMakeCache.txt" } not found'
52+
53+ # Publish the project to the local cache
Original file line number Diff line number Diff line change 11"""Integration tests for the provider"""
22
3- from pathlib import Path
43from typing import Any
54
65import pytest
76
87from cppython .plugins .conan .plugin import ConanProvider
98from cppython .test .pytest .contracts import ProviderIntegrationTestContract
109
11-
12- @pytest .fixture (autouse = True )
13- def clean_conan_cache (tmp_path : Path , monkeypatch : pytest .MonkeyPatch ):
14- """Sets CONAN_HOME to a temporary directory for each test.
15-
16- This ensures all tests run with a clean Conan cache.
17-
18- Args:
19- tmp_path: Pytest temporary directory fixture
20- monkeypatch: Pytest monkeypatch fixture for environment variable manipulation
21- """
22- conan_home = tmp_path / 'conan_home'
23- conan_home .mkdir ()
24-
25- # Set CONAN_HOME to the temporary directory
26- monkeypatch .setenv ('CONAN_HOME' , str (conan_home ))
10+ pytest_plugins = ['tests.fixtures.conan' ]
2711
2812
2913class TestConanProvider (ProviderIntegrationTestContract [ConanProvider ]):
You can’t perform that action at this time.
0 commit comments