From 43c74bd9970754b727410b0ba7474732e519b908 Mon Sep 17 00:00:00 2001 From: bwoodsend Date: Sat, 3 Oct 2020 14:58:29 +0100 Subject: [PATCH] Tests: Update sysconfig test to not depend on obsolete data files. The pyconfig.h and makefile are no longer used. The correct way to use sysconfig is through `sysconfig.get_config_vars()` which is now tested instead of checking the files are present. --- tests/functional/test_basic.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/functional/test_basic.py b/tests/functional/test_basic.py index df9cdaef3c5..b5b35a8eafd 100644 --- a/tests/functional/test_basic.py +++ b/tests/functional/test_basic.py @@ -332,9 +332,20 @@ def MyEXE(*args, **kwargs): _, err = capsys.readouterr() assert "'import warnings' failed" not in err -@skipif_win -def test_python_makefile(pyi_builder): - pyi_builder.test_script('pyi_python_makefile.py') + +@pytest.mark.parametrize("distutils", ["", "from distutils "]) +def test_python_makefile(pyi_builder, distutils): + """Tests hooks for ``sysconfig`` and its near-duplicate + ``distutils.sysconfig``. Should raise a distutils error if it needed the + ``pyconfig.h`` and ``makefile`` and didn't get them. Or an import error if + we failed to include the special extension module that replaced those + files in more modern Python versions. + """ + pyi_builder.test_source(""" + {}import sysconfig + from pprint import pprint + pprint(sysconfig.get_config_vars()) + """.format(distutils)) def test_set_icon(pyi_builder, data_dir):