@@ -657,6 +657,53 @@ def test_pytorch_gpu(specs):
657657 raise AssertionError ("No pytorch found" )
658658
659659
660+ _CROSS_PLATFORM_TARGET = "linux-64" if context .subdir != "linux-64" else "win-64"
661+
662+
663+ @pytest .mark .parametrize (
664+ "subdirs,expected_platform" ,
665+ (
666+ pytest .param (
667+ (_CROSS_PLATFORM_TARGET , "noarch" ),
668+ _CROSS_PLATFORM_TARGET ,
669+ id = "cross-platform-target" ,
670+ ),
671+ pytest .param (
672+ ("noarch" ,),
673+ context .subdir ,
674+ id = "noarch-only-fallback" ,
675+ ),
676+ ),
677+ )
678+ def test_cross_platform_spinner_message (
679+ tmp_path : Path ,
680+ subdirs : tuple [str , ...],
681+ expected_platform : str ,
682+ ) -> None :
683+ """
684+ https://github.com/conda/conda-libmamba-solver/pull/911
685+
686+ The ``Platform:`` line of the metadata-collection spinner message should
687+ show the first non-``noarch`` entry of ``self.subdirs`` (the actual
688+ target platform during cross-platform export) and fall back to
689+ ``context.subdir`` when ``self.subdirs`` only contains ``noarch``.
690+ """
691+ from conda .models .channel import Channel
692+
693+ solver = Solver (
694+ prefix = tmp_path ,
695+ channels = ["conda-forge" ],
696+ specs_to_add = ["tzdata" ],
697+ command = "create" ,
698+ )
699+ # Assign after construction so the noarch-only case bypasses the
700+ # ``next(s for s in self.subdirs if s != "noarch")`` call in ``__init__``.
701+ solver .subdirs = subdirs
702+ message = solver ._collect_all_metadata_spinner_message (channels = [Channel ("conda-forge" )])
703+ assert f"Platform: { expected_platform } " in message
704+ assert "Platform: noarch" not in message
705+
706+
660707def test_channel_subdir_set_correctly (tmp_env : TmpEnvFixture ) -> None :
661708 """
662709 https://github.com/conda/conda-libmamba-solver/issues/662
0 commit comments