diff --git a/cppython/plugins/conan/plugin.py b/cppython/plugins/conan/plugin.py index f334f0f..0e4ebd8 100644 --- a/cppython/plugins/conan/plugin.py +++ b/cppython/plugins/conan/plugin.py @@ -77,7 +77,7 @@ def _install_dependencies(self, *, update: bool = False) -> None: If False, use cached versions when available. """ operation = 'update' if update else 'install' - + try: # Setup environment and generate conanfile conan_api, conanfile_path = self._prepare_installation() @@ -247,6 +247,7 @@ def publish(self) -> None: raise FileNotFoundError(f'conanfile.py not found at {conanfile_path}') conan_api = ConanAPI() + all_remotes = conan_api.remotes.list() # Configure remotes for upload @@ -272,7 +273,7 @@ def publish(self) -> None: user=None, channel=None, lockfile=None, - remotes=all_remotes, + remotes=all_remotes, # Use all remotes for dependency resolution update=None, check_updates=False, is_build_require=False, @@ -284,22 +285,31 @@ def publish(self) -> None: conan_api.graph.analyze_binaries( graph=deps_graph, build_mode=['*'], - remotes=all_remotes, + remotes=all_remotes, # Use all remotes for dependency resolution update=None, lockfile=None, ) conan_api.install.install_binaries(deps_graph=deps_graph, remotes=all_remotes) - # Upload if not local only - if not self.data.local_only: + if not self.data.skip_upload: self._upload_package(conan_api, ref, configured_remotes) def _get_configured_remotes(self, all_remotes): - """Get and validate configured remotes for upload.""" - if self.data.local_only: + """Get and validate configured remotes for upload. + + Note: This only affects upload behavior. For dependency resolution, + we always use all available system remotes regardless of this config. + """ + # If skip_upload is True, don't upload anywhere + if self.data.skip_upload: return [] + # If no remotes specified, upload to all available remotes + if not self.data.remotes: + return all_remotes + + # Otherwise, upload only to specified remotes configured_remotes = [remote for remote in all_remotes if remote.name in self.data.remotes] if not configured_remotes: diff --git a/cppython/plugins/conan/resolution.py b/cppython/plugins/conan/resolution.py index 2f1f663..4f5f868 100644 --- a/cppython/plugins/conan/resolution.py +++ b/cppython/plugins/conan/resolution.py @@ -318,6 +318,7 @@ def resolve_conan_data(data: dict[str, Any], core_data: CorePluginData) -> Conan return ConanData( remotes=parsed_data.remotes, + skip_upload=parsed_data.skip_upload, host_profile=host_profile, build_profile=build_profile, ) diff --git a/cppython/plugins/conan/schema.py b/cppython/plugins/conan/schema.py index 08129c0..19d2e73 100644 --- a/cppython/plugins/conan/schema.py +++ b/cppython/plugins/conan/schema.py @@ -293,22 +293,22 @@ class ConanData(CPPythonModel): """Resolved conan data""" remotes: list[str] + skip_upload: bool host_profile: Profile build_profile: Profile - @property - def local_only(self) -> bool: - """Check if publishing should be local-only.""" - return len(self.remotes) == 0 - class ConanConfiguration(CPPythonModel): """Raw conan data""" remotes: Annotated[ list[str], - Field(description='List of remotes to upload to. Empty list means the local conan cache will be used.'), + Field(description='List of remotes to upload to. If empty, uploads to all available remotes.'), ] = ['conancenter'] + skip_upload: Annotated[ + bool, + Field(description='If true, skip uploading packages during publish (local-only mode).'), + ] = False host_profile: Annotated[ str | None, Field( diff --git a/pdm.lock b/pdm.lock index 6ee6941..aff0232 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "cmake", "conan", "git", "lint", "pdm", "pytest", "release", "test"] strategy = [] lock_version = "4.5.0" -content_hash = "sha256:285d4e6ecf91477f083161753ad4b59416cfb56c5c5076bcc8028f7429129061" +content_hash = "sha256:bbd888727dfc7101af521ae5aadf9644ae7879f21fb1d1b3a5f804257e8cdd4c" [[metadata.targets]] requires_python = ">=3.13" @@ -87,6 +87,7 @@ files = [ [[package]] name = "cmake" version = "4.0.3" +requires_python = ">=3.7" summary = "" files = [ {file = "cmake-4.0.3-py3-none-macosx_10_10_universal2.whl", hash = "sha256:f2adfb459747025f40f9d3bdd1f3a485d43e866c0c4eb66373d1fcd666b13e4a"}, @@ -122,6 +123,7 @@ files = [ [[package]] name = "conan" version = "2.18.1" +requires_python = ">=3.6" summary = "" dependencies = [ "colorama", @@ -202,6 +204,7 @@ files = [ [[package]] name = "dulwich" version = "0.23.2" +requires_python = ">=3.9" summary = "" dependencies = [ "urllib3", @@ -364,6 +367,7 @@ files = [ [[package]] name = "libcst" version = "1.8.2" +requires_python = ">=3.9" summary = "" dependencies = [ "pyyaml-ft", @@ -444,6 +448,7 @@ files = [ [[package]] name = "packaging" version = "25.0" +requires_python = ">=3.8" summary = "" files = [ {file = "packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484"}, @@ -470,6 +475,7 @@ files = [ [[package]] name = "pdm" version = "2.25.4" +requires_python = ">=3.9" summary = "" dependencies = [ "blinker", @@ -521,6 +527,7 @@ files = [ [[package]] name = "pydantic" version = "2.11.7" +requires_python = ">=3.9" summary = "" dependencies = [ "annotated-types", @@ -581,23 +588,25 @@ files = [ [[package]] name = "pyrefly" -version = "0.23.1" -summary = "" +version = "0.24.2" +requires_python = ">=3.8" +summary = "A fast Python type checker written in Rust" files = [ - {file = "pyrefly-0.23.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:a25506700f179004438221aa50aa107f70dc52d08ee538150ef1c3789544f921"}, - {file = "pyrefly-0.23.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:5307f3184b69effbb867be07c09a0181347b76b1723f3ed246030fb253dde4f2"}, - {file = "pyrefly-0.23.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4f59e2c0cf65d1f10e9a0b9c7de63c677a17c3634d60bfa3a3426cd0184e73b4"}, - {file = "pyrefly-0.23.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:2cd03be65aa0b527e29855a42354641f612885587cb40e6ae8bb91b739a4fca6"}, - {file = "pyrefly-0.23.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93d841cb1cd5164407482cb30b09fc25ceaa113809d7715e454dd3cd47faf140"}, - {file = "pyrefly-0.23.1-py3-none-win32.whl", hash = "sha256:b077ba0c832a3994e5f457066bd391eaecbfd2332e15beb4dd42658e39371d93"}, - {file = "pyrefly-0.23.1-py3-none-win_amd64.whl", hash = "sha256:c6f621d22e528904b9253bd378b45e475f2b4e0e43bf85088654383ec42b98c8"}, - {file = "pyrefly-0.23.1-py3-none-win_arm64.whl", hash = "sha256:e567ad4e1001040cfca7418b1bc2ec21c4c6f96fd1102e848ad8ced0bd5dcdb7"}, - {file = "pyrefly-0.23.1.tar.gz", hash = "sha256:7032d97dfdf885e8309e9d78bd70b332649544e1f36905082f703e133f575aaa"}, + {file = "pyrefly-0.24.2-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:7e6bd1b88ec53b3f1ce2ece844016d7e7f0848a77022857a7fa6674a49abcc13"}, + {file = "pyrefly-0.24.2-py3-none-macosx_11_0_arm64.whl", hash = "sha256:83aa9013f2299dfc8ce11adec30a63be71528484c45e603375efe7496cb0538e"}, + {file = "pyrefly-0.24.2-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3bf1689032b78f8f653244cd323ee1e06a0efb6192c4d7a415d1e85aedd37905"}, + {file = "pyrefly-0.24.2-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:8404b804a5a1bc4a54cc8e58bceacdf49d7221531843c068547241d8f476af24"}, + {file = "pyrefly-0.24.2-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:14d09f166a46e43655ea812611887ca16a0c54386296f4c9333f3f5fc7236709"}, + {file = "pyrefly-0.24.2-py3-none-win32.whl", hash = "sha256:6c602df48dcfa3240f9076c7d1e9cf9dc2d94c90ee5b4c6745f3734125a2cf3a"}, + {file = "pyrefly-0.24.2-py3-none-win_amd64.whl", hash = "sha256:9ed4690716eb47077082d4e99624e0a1165b9ac93300c8d823f42cae12ec1ef4"}, + {file = "pyrefly-0.24.2-py3-none-win_arm64.whl", hash = "sha256:96ba49c02f374d716b8674409aa653093dad5263cf4e429a1d5ec603064db715"}, + {file = "pyrefly-0.24.2.tar.gz", hash = "sha256:671b9933c2a3f646983de68bc0422736f7ce364c4f645f742559423b0b9b5150"}, ] [[package]] name = "pytest" version = "8.4.1" +requires_python = ">=3.9" summary = "" dependencies = [ "colorama; sys_platform == \"win32\"", @@ -614,6 +623,7 @@ files = [ [[package]] name = "pytest-cov" version = "6.2.1" +requires_python = ">=3.9" summary = "" dependencies = [ "coverage", @@ -628,6 +638,7 @@ files = [ [[package]] name = "pytest-mock" version = "3.14.1" +requires_python = ">=3.8" summary = "" dependencies = [ "pytest", @@ -702,6 +713,7 @@ files = [ [[package]] name = "requests" version = "2.32.4" +requires_python = ">=3.8" summary = "" dependencies = [ "certifi", @@ -738,27 +750,28 @@ files = [ [[package]] name = "ruff" -version = "0.12.3" -summary = "" -files = [ - {file = "ruff-0.12.3-py3-none-linux_armv6l.whl", hash = "sha256:47552138f7206454eaf0c4fe827e546e9ddac62c2a3d2585ca54d29a890137a2"}, - {file = "ruff-0.12.3-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:0a9153b000c6fe169bb307f5bd1b691221c4286c133407b8827c406a55282041"}, - {file = "ruff-0.12.3-py3-none-macosx_11_0_arm64.whl", hash = "sha256:fa6b24600cf3b750e48ddb6057e901dd5b9aa426e316addb2a1af185a7509882"}, - {file = "ruff-0.12.3-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e2506961bf6ead54887ba3562604d69cb430f59b42133d36976421bc8bd45901"}, - {file = "ruff-0.12.3-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:c4faaff1f90cea9d3033cbbcdf1acf5d7fb11d8180758feb31337391691f3df0"}, - {file = "ruff-0.12.3-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:40dced4a79d7c264389de1c59467d5d5cefd79e7e06d1dfa2c75497b5269a5a6"}, - {file = "ruff-0.12.3-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:0262d50ba2767ed0fe212aa7e62112a1dcbfd46b858c5bf7bbd11f326998bafc"}, - {file = "ruff-0.12.3-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:12371aec33e1a3758597c5c631bae9a5286f3c963bdfb4d17acdd2d395406687"}, - {file = "ruff-0.12.3-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:560f13b6baa49785665276c963edc363f8ad4b4fc910a883e2625bdb14a83a9e"}, - {file = "ruff-0.12.3-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:023040a3499f6f974ae9091bcdd0385dd9e9eb4942f231c23c57708147b06311"}, - {file = "ruff-0.12.3-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:883d844967bffff5ab28bba1a4d246c1a1b2933f48cb9840f3fdc5111c603b07"}, - {file = "ruff-0.12.3-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:2120d3aa855ff385e0e562fdee14d564c9675edbe41625c87eeab744a7830d12"}, - {file = "ruff-0.12.3-py3-none-musllinux_1_2_i686.whl", hash = "sha256:6b16647cbb470eaf4750d27dddc6ebf7758b918887b56d39e9c22cce2049082b"}, - {file = "ruff-0.12.3-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:e1417051edb436230023575b149e8ff843a324557fe0a265863b7602df86722f"}, - {file = "ruff-0.12.3-py3-none-win32.whl", hash = "sha256:dfd45e6e926deb6409d0616078a666ebce93e55e07f0fb0228d4b2608b2c248d"}, - {file = "ruff-0.12.3-py3-none-win_amd64.whl", hash = "sha256:a946cf1e7ba3209bdef039eb97647f1c77f6f540e5845ec9c114d3af8df873e7"}, - {file = "ruff-0.12.3-py3-none-win_arm64.whl", hash = "sha256:5f9c7c9c8f84c2d7f27e93674d27136fbf489720251544c4da7fb3d742e011b1"}, - {file = "ruff-0.12.3.tar.gz", hash = "sha256:f1b5a4b6668fd7b7ea3697d8d98857390b40c1320a63a178eee6be0899ea2d77"}, +version = "0.12.4" +requires_python = ">=3.7" +summary = "An extremely fast Python linter and code formatter, written in Rust." +files = [ + {file = "ruff-0.12.4-py3-none-linux_armv6l.whl", hash = "sha256:cb0d261dac457ab939aeb247e804125a5d521b21adf27e721895b0d3f83a0d0a"}, + {file = "ruff-0.12.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:55c0f4ca9769408d9b9bac530c30d3e66490bd2beb2d3dae3e4128a1f05c7442"}, + {file = "ruff-0.12.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:a8224cc3722c9ad9044da7f89c4c1ec452aef2cfe3904365025dd2f51daeae0e"}, + {file = "ruff-0.12.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e9949d01d64fa3672449a51ddb5d7548b33e130240ad418884ee6efa7a229586"}, + {file = "ruff-0.12.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:be0593c69df9ad1465e8a2d10e3defd111fdb62dcd5be23ae2c06da77e8fcffb"}, + {file = "ruff-0.12.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:a7dea966bcb55d4ecc4cc3270bccb6f87a337326c9dcd3c07d5b97000dbff41c"}, + {file = "ruff-0.12.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:afcfa3ab5ab5dd0e1c39bf286d829e042a15e966b3726eea79528e2e24d8371a"}, + {file = "ruff-0.12.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c057ce464b1413c926cdb203a0f858cd52f3e73dcb3270a3318d1630f6395bb3"}, + {file = "ruff-0.12.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e64b90d1122dc2713330350626b10d60818930819623abbb56535c6466cce045"}, + {file = "ruff-0.12.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2abc48f3d9667fdc74022380b5c745873499ff827393a636f7a59da1515e7c57"}, + {file = "ruff-0.12.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:2b2449dc0c138d877d629bea151bee8c0ae3b8e9c43f5fcaafcd0c0d0726b184"}, + {file = "ruff-0.12.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:56e45bb11f625db55f9b70477062e6a1a04d53628eda7784dce6e0f55fd549eb"}, + {file = "ruff-0.12.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:478fccdb82ca148a98a9ff43658944f7ab5ec41c3c49d77cd99d44da019371a1"}, + {file = "ruff-0.12.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:0fc426bec2e4e5f4c4f182b9d2ce6a75c85ba9bcdbe5c6f2a74fcb8df437df4b"}, + {file = "ruff-0.12.4-py3-none-win32.whl", hash = "sha256:4de27977827893cdfb1211d42d84bc180fceb7b72471104671c59be37041cf93"}, + {file = "ruff-0.12.4-py3-none-win_amd64.whl", hash = "sha256:fe0b9e9eb23736b453143d72d2ceca5db323963330d5b7859d60d101147d461a"}, + {file = "ruff-0.12.4-py3-none-win_arm64.whl", hash = "sha256:0618ec4442a83ab545e5b71202a5c0ed7791e8471435b94e655b570a5031a98e"}, + {file = "ruff-0.12.4.tar.gz", hash = "sha256:13efa16df6c6eeb7d0f091abae50f58e9522f3843edb40d56ad52a5a4a4b6873"}, ] [[package]] @@ -818,6 +831,7 @@ files = [ [[package]] name = "typer" version = "0.16.0" +requires_python = ">=3.7" summary = "" dependencies = [ "click", @@ -833,6 +847,7 @@ files = [ [[package]] name = "types-requests" version = "2.32.4.20250611" +requires_python = ">=3.9" summary = "" dependencies = [ "urllib3", diff --git a/pyproject.toml b/pyproject.toml index 0d0cc42..405cd79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,11 +20,23 @@ dependencies = [ ] [project.optional-dependencies] -pytest = ["pytest>=8.4.1", "pytest-mock>=3.14.1"] -git = ["dulwich>=0.23.2"] -pdm = ["pdm>=2.25.4"] -cmake = ["cmake>=4.0.3"] -conan = ["conan>=2.18.1", "libcst>=1.8.2"] +pytest = [ + "pytest>=8.4.1", + "pytest-mock>=3.14.1", +] +git = [ + "dulwich>=0.23.2", +] +pdm = [ + "pdm>=2.25.4", +] +cmake = [ + "cmake>=4.0.3", +] +conan = [ + "conan>=2.18.1", + "libcst>=1.8.2", +] [project.urls] homepage = "https://github.com/Synodic-Software/CPPython" @@ -47,8 +59,15 @@ cppython = "cppython.plugins.pdm.plugin:CPPythonPlugin" cppython = "cppython.test.pytest.fixtures" [dependency-groups] -lint = ["ruff>=0.12.3", "pyrefly>=0.23.1"] -test = ["pytest>=8.4.1", "pytest-cov>=6.2.1", "pytest-mock>=3.14.1"] +lint = [ + "ruff>=0.12.4", + "pyrefly>=0.24.2", +] +test = [ + "pytest>=8.4.1", + "pytest-cov>=6.2.1", + "pytest-mock>=3.14.1", +] [project.scripts] cppython = "cppython.console.entry:app" diff --git a/tests/fixtures/conan.py b/tests/fixtures/conan.py index 8fd0629..f13eb0d 100644 --- a/tests/fixtures/conan.py +++ b/tests/fixtures/conan.py @@ -1,6 +1,7 @@ """Shared fixtures for Conan plugin tests""" from pathlib import Path +from typing import Any from unittest.mock import Mock import pytest @@ -10,6 +11,24 @@ from cppython.plugins.conan.plugin import ConanProvider from cppython.plugins.conan.schema import ConanDependency +# Shared parameterization for plugin data across all conan tests +CONAN_PLUGIN_DATA_PARAMS = [ + {'remotes': ['conancenter'], 'skip_upload': False}, # Default behavior + {'remotes': [], 'skip_upload': False}, # Empty remotes (upload to all) + {'remotes': ['conancenter'], 'skip_upload': True}, # Skip upload with specific remotes + {'remotes': [], 'skip_upload': True}, # Skip upload with empty remotes +] + + +@pytest.fixture(name='conan_plugin_data', scope='session', params=CONAN_PLUGIN_DATA_PARAMS) +def fixture_conan_plugin_data(request) -> dict[str, Any]: + """Shared parameterized plugin data for conan tests + + Returns: + The constructed plugin data with different combinations of remotes and skip_upload + """ + return request.param + @pytest.fixture(autouse=True) def clean_conan_cache(tmp_path: Path, monkeypatch: pytest.MonkeyPatch): diff --git a/tests/integration/examples/test_conan_cmake.py b/tests/integration/examples/test_conan_cmake.py index a796a90..f62f342 100644 --- a/tests/integration/examples/test_conan_cmake.py +++ b/tests/integration/examples/test_conan_cmake.py @@ -52,7 +52,7 @@ def test_simple(example_runner: CliRunner) -> None: # --- Setup for Publish with modified config --- # Modify the in-memory representation of the pyproject data - pyproject_data['tool']['cppython']['providers']['conan']['remotes'] = [] + pyproject_data['tool']['cppython']['providers']['conan']['skip_upload'] = True # Create a new project instance with the modified configuration for the 'publish' step publish_project = Project(project_configuration, interface, pyproject_data) diff --git a/tests/unit/plugins/conan/test_install.py b/tests/unit/plugins/conan/test_install.py index 31aac74..d90c982 100644 --- a/tests/unit/plugins/conan/test_install.py +++ b/tests/unit/plugins/conan/test_install.py @@ -29,15 +29,13 @@ class TestConanInstall(ProviderPluginTestMixin[ConanProvider]): @staticmethod @pytest.fixture(name='plugin_data', scope='session') - def fixture_plugin_data() -> dict[str, Any]: + def fixture_plugin_data(conan_plugin_data: dict[str, Any]) -> dict[str, Any]: """A required testing hook that allows data generation Returns: The constructed plugin data """ - return { - 'remotes': [], - } + return conan_plugin_data @staticmethod @pytest.fixture(name='plugin_type', scope='session') diff --git a/tests/unit/plugins/conan/test_provider.py b/tests/unit/plugins/conan/test_provider.py index 28ebc09..94e75ee 100644 --- a/tests/unit/plugins/conan/test_provider.py +++ b/tests/unit/plugins/conan/test_provider.py @@ -13,13 +13,13 @@ class TestConanProvider(ProviderUnitTestContract[ConanProvider]): @staticmethod @pytest.fixture(name='plugin_data', scope='session') - def fixture_plugin_data() -> dict[str, Any]: + def fixture_plugin_data(conan_plugin_data: dict[str, Any]) -> dict[str, Any]: """A required testing hook that allows data generation Returns: The constructed plugin data """ - return {} + return conan_plugin_data @staticmethod @pytest.fixture(name='plugin_type', scope='session') diff --git a/tests/unit/plugins/conan/test_publish.py b/tests/unit/plugins/conan/test_publish.py index 6e6e60d..163eeba 100644 --- a/tests/unit/plugins/conan/test_publish.py +++ b/tests/unit/plugins/conan/test_publish.py @@ -42,10 +42,10 @@ def fixture_plugin_type() -> type[ConanProvider]: """ return ConanProvider - def test_local_only( + def test_skip_upload( self, plugin: ConanProvider, conan_mock_api_publish: Mock, conan_temp_conanfile: None, mocker: MockerFixture ) -> None: - """Test that publish with remotes=[] only exports and builds locally + """Test that publish with skip_upload=True only exports and builds locally Args: plugin: The plugin instance @@ -53,8 +53,8 @@ def test_local_only( conan_temp_conanfile: Fixture to create conanfile.py mocker: Pytest mocker fixture """ - # Set plugin to local mode - plugin.data.remotes = [] + # Set plugin to skip upload mode + plugin.data.skip_upload = True # Mock the necessary imports and API creation mocker.patch('cppython.plugins.conan.plugin.ConanAPI', return_value=conan_mock_api_publish) @@ -190,8 +190,8 @@ def test_with_default_profiles( conan_temp_conanfile: Fixture to create conanfile.py mocker: Pytest mocker fixture """ - # Set plugin to local mode - plugin.data.remotes = [] + # Set plugin to skip upload mode + plugin.data.skip_upload = True # Mock the necessary imports and API creation mocker.patch('cppython.plugins.conan.plugin.ConanAPI', return_value=conan_mock_api_publish) diff --git a/tests/unit/plugins/conan/test_resolution.py b/tests/unit/plugins/conan/test_resolution.py index 85511c7..a9034fe 100644 --- a/tests/unit/plugins/conan/test_resolution.py +++ b/tests/unit/plugins/conan/test_resolution.py @@ -446,7 +446,7 @@ def test_null_profiles( mock_build_profile = Mock(spec=Profile) mock_resolve_profiles.return_value = (mock_host_profile, mock_build_profile) - data = {'host_profile': None, 'build_profile': None, 'remotes': []} + data = {'host_profile': None, 'build_profile': None, 'remotes': [], 'skip_upload': False} core_data = Mock(spec=CorePluginData) result = resolve_conan_data(data, core_data) @@ -455,6 +455,7 @@ def test_null_profiles( assert result.host_profile == mock_host_profile assert result.build_profile == mock_build_profile assert result.remotes == [] + assert result.skip_upload is False # Verify profile resolution was called with None values mock_resolve_profiles.assert_called_once_with(None, None, mock_conan_api, None) diff --git a/tests/unit/plugins/conan/test_update.py b/tests/unit/plugins/conan/test_update.py index d862202..b39e780 100644 --- a/tests/unit/plugins/conan/test_update.py +++ b/tests/unit/plugins/conan/test_update.py @@ -20,15 +20,13 @@ class TestConanUpdate(ProviderPluginTestMixin[ConanProvider]): @staticmethod @pytest.fixture(name='plugin_data', scope='session') - def fixture_plugin_data() -> dict[str, Any]: + def fixture_plugin_data(conan_plugin_data: dict[str, Any]) -> dict[str, Any]: """A required testing hook that allows data generation Returns: The constructed plugin data """ - return { - 'remotes': [], - } + return conan_plugin_data @staticmethod @pytest.fixture(name='plugin_type', scope='session')