@@ -624,27 +624,6 @@ def test_backcompat_cmake_build_env(tmp_path: Path, monkeypatch: pytest.MonkeyPa
624624 assert settings_reader .settings .build .targets == ["a" , "b" ]
625625
626626
627- def test_backcompat_cmake_build_both_specified (
628- tmp_path : Path , monkeypatch : pytest .MonkeyPatch
629- ):
630- monkeypatch .setattr (
631- scikit_build_core .settings .skbuild_read_settings , "__version__" , "0.10.0"
632- )
633- pyproject_toml = tmp_path / "pyproject.toml"
634- pyproject_toml .write_text (
635- textwrap .dedent (
636- """\
637- [tool.scikit-build]
638- cmake.verbose = true
639- """
640- ),
641- encoding = "utf-8" ,
642- )
643-
644- with pytest .raises (SystemExit ):
645- SettingsReader .from_file (pyproject_toml , {"build.verbose" : "1" })
646-
647-
648627def test_auto_minimum_version (tmp_path : Path , monkeypatch : pytest .MonkeyPatch ):
649628 monkeypatch .setattr (
650629 scikit_build_core .settings .skbuild_read_settings , "__version__" , "0.10.0"
@@ -813,3 +792,135 @@ def test_skbuild_settings_cmake_define_list():
813792 "NESTED_LIST" : r"Apple;Lemon\;Lime;Banana" ,
814793 "ONE_LEVEL_LIST" : "Foo;Bar;ExceptionallyLargeListEntryThatWouldOverflowTheLine;Baz" ,
815794 }
795+
796+
797+ def test_skbuild_override_renamed (
798+ tmp_path : Path , monkeypatch : pytest .MonkeyPatch
799+ ) -> None :
800+ monkeypatch .setattr (
801+ scikit_build_core .settings .skbuild_read_settings , "__version__" , "0.10.0"
802+ )
803+ pyproject_toml = tmp_path / "pyproject.toml"
804+ pyproject_toml .write_text (
805+ textwrap .dedent (
806+ """\
807+ [tool.scikit-build]
808+ minimum-version = "0.7"
809+ """
810+ ),
811+ encoding = "utf-8" ,
812+ )
813+
814+ settings_reader = SettingsReader .from_file (pyproject_toml , {"build.verbose" : "1" })
815+ assert settings_reader .settings .build .verbose
816+
817+ settings_reader = SettingsReader .from_file (
818+ pyproject_toml , env = {"SKBUILD_BUILD_VERBOSE" : "TRUE" }
819+ )
820+ assert settings_reader .settings .build .verbose
821+
822+
823+ def test_skbuild_override_renamed_fail (
824+ tmp_path : Path , monkeypatch : pytest .MonkeyPatch
825+ ) -> None :
826+ monkeypatch .setattr (
827+ scikit_build_core .settings .skbuild_read_settings , "__version__" , "0.10.0"
828+ )
829+ pyproject_toml = tmp_path / "pyproject.toml"
830+ pyproject_toml .write_text (
831+ textwrap .dedent (
832+ """\
833+ [tool.scikit-build]
834+ minimum-version = "0.7"
835+ build.verbose = true
836+ """
837+ ),
838+ encoding = "utf-8" ,
839+ )
840+
841+ with pytest .raises (SystemExit ):
842+ SettingsReader .from_file (pyproject_toml )
843+
844+
845+ def test_skbuild_override_static (
846+ tmp_path : Path , monkeypatch : pytest .MonkeyPatch
847+ ) -> None :
848+ monkeypatch .setattr (
849+ scikit_build_core .settings .skbuild_read_settings , "__version__" , "0.10.0"
850+ )
851+ pyproject_toml = tmp_path / "pyproject.toml"
852+ pyproject_toml .write_text (
853+ textwrap .dedent (
854+ """\
855+ [tool.scikit-build]
856+ minimum-version = "0.7"
857+ build.verbose = true
858+ """
859+ ),
860+ encoding = "utf-8" ,
861+ )
862+ with pytest .raises (SystemExit ):
863+ SettingsReader .from_file (pyproject_toml )
864+
865+
866+ def test_backcompat_cmake_build_both_specified (
867+ tmp_path : Path , monkeypatch : pytest .MonkeyPatch
868+ ):
869+ monkeypatch .setattr (
870+ scikit_build_core .settings .skbuild_read_settings , "__version__" , "0.10.0"
871+ )
872+ pyproject_toml = tmp_path / "pyproject.toml"
873+ pyproject_toml .write_text (
874+ textwrap .dedent (
875+ """\
876+ [tool.scikit-build]
877+ cmake.verbose = true
878+ """
879+ ),
880+ encoding = "utf-8" ,
881+ )
882+
883+ settings_reader = SettingsReader .from_file (pyproject_toml , {"build.verbose" : "1" })
884+ assert settings_reader .settings .build .verbose
885+
886+
887+ def test_backcompat_cmake_build_both_specified_static (
888+ tmp_path : Path , monkeypatch : pytest .MonkeyPatch
889+ ):
890+ monkeypatch .setattr (
891+ scikit_build_core .settings .skbuild_read_settings , "__version__" , "0.10.0"
892+ )
893+ pyproject_toml = tmp_path / "pyproject.toml"
894+ pyproject_toml .write_text (
895+ textwrap .dedent (
896+ """\
897+ [tool.scikit-build]
898+ build.verbose = true
899+ """
900+ ),
901+ encoding = "utf-8" ,
902+ )
903+
904+ settings_reader = SettingsReader .from_file (pyproject_toml , {"cmake.verbose" : "1" })
905+ assert settings_reader .settings .build .verbose
906+
907+
908+ def test_backcompat_cmake_build_targets_both_specified (
909+ tmp_path : Path , monkeypatch : pytest .MonkeyPatch
910+ ):
911+ monkeypatch .setattr (
912+ scikit_build_core .settings .skbuild_read_settings , "__version__" , "0.10.0"
913+ )
914+ pyproject_toml = tmp_path / "pyproject.toml"
915+ pyproject_toml .write_text (
916+ textwrap .dedent (
917+ """\
918+ [tool.scikit-build]
919+ cmake.targets = ["a", "b"]
920+ """
921+ ),
922+ encoding = "utf-8" ,
923+ )
924+
925+ settings_reader = SettingsReader .from_file (pyproject_toml , {"build.targets" : "c;d" })
926+ assert settings_reader .settings .build .targets == ["c" , "d" ]
0 commit comments