Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
test_mingw.py49 linesDownload Raw Back to tests
1from distutils import sysconfig2from distutils.errors import DistutilsPlatformError3from distutils.util import is_mingw, split_quoted4 5import pytest6 7from .. import cygwin, errors8 9 10class TestMinGW32Compiler:11    @pytest.mark.skipif(not is_mingw(), reason='not on mingw')12    def test_compiler_type(self):13        compiler = cygwin.MinGW32Compiler()14        assert compiler.compiler_type == 'mingw32'15 16    @pytest.mark.skipif(not is_mingw(), reason='not on mingw')17    def test_set_executables(self, monkeypatch):18        monkeypatch.setenv('CC', 'cc')19        monkeypatch.setenv('CXX', 'c++')20 21        compiler = cygwin.MinGW32Compiler()22 23        assert compiler.compiler == split_quoted('cc -O -Wall')24        assert compiler.compiler_so == split_quoted('cc -shared -O -Wall')25        assert compiler.compiler_cxx == split_quoted('c++ -O -Wall')26        assert compiler.linker_exe == split_quoted('cc')27        assert compiler.linker_so == split_quoted('cc -shared')28 29    @pytest.mark.skipif(not is_mingw(), reason='not on mingw')30    def test_runtime_library_dir_option(self):31        compiler = cygwin.MinGW32Compiler()32        with pytest.raises(DistutilsPlatformError):33            compiler.runtime_library_dir_option('/usr/lib')34 35    @pytest.mark.skipif(not is_mingw(), reason='not on mingw')36    def test_cygwincc_error(self, monkeypatch):37        monkeypatch.setattr(cygwin, 'is_cygwincc', lambda _: True)38 39        with pytest.raises(errors.Error):40            cygwin.MinGW32Compiler()41 42    @pytest.mark.skipif('sys.platform == "cygwin"')43    def test_customize_compiler_with_msvc_python(self):44        # In case we have an MSVC Python build, but still want to use45        # MinGW32Compiler, then customize_compiler() shouldn't fail at least.46        # https://github.com/pypa/setuptools/issues/445647        compiler = cygwin.MinGW32Compiler()48        sysconfig.customize_compiler(compiler)49 
codekingpro/portable-devtools · Team Ai