From 19af16b0ec4149f3b00d4e05dfce8ad4f61310e1 Mon Sep 17 00:00:00 2001 From: tarek Date: Sun, 20 Sep 2009 14:45:46 +0200 Subject: make sure setuptools does like distutils in get_ext_filename fixes #41 --HG-- branch : distribute extra : rebase_source : 4401307be98ca2fb74e715a258b7af74eaa62db2 --- setuptools/tests/test_build_ext.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 setuptools/tests/test_build_ext.py (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py new file mode 100644 index 00000000..a520ced9 --- /dev/null +++ b/setuptools/tests/test_build_ext.py @@ -0,0 +1,20 @@ +"""build_ext tests +""" +import os, shutil, tempfile, unittest +from distutils.command.build_ext import build_ext as distutils_build_ext +from setuptools.command.build_ext import build_ext +from setuptools.dist import Distribution + +class TestBuildExtTest(unittest.TestCase): + + def test_get_ext_filename(self): + # setuptools needs to give back the same + # result than distutils, even if the fullname + # is not in ext_map + dist = Distribution() + cmd = build_ext(dist) + cmd.ext_map['foo/bar'] = '' + res = cmd.get_ext_filename('foo') + wanted = distutils_build_ext.get_ext_filename(cmd, 'foo') + assert res == wanted + -- cgit v1.2.1 From 657501ddc8410495c9f44b7280f4a7abf3241753 Mon Sep 17 00:00:00 2001 From: Arfrever Frehtes Taifersar Arahesis Date: Sat, 15 Feb 2014 22:54:03 +0100 Subject: Clean some imports. --- setuptools/tests/test_build_ext.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index a520ced9..a92e53ae 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -1,6 +1,6 @@ """build_ext tests """ -import os, shutil, tempfile, unittest +import unittest from distutils.command.build_ext import build_ext as distutils_build_ext from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution @@ -17,4 +17,3 @@ class TestBuildExtTest(unittest.TestCase): res = cmd.get_ext_filename('foo') wanted = distutils_build_ext.get_ext_filename(cmd, 'foo') assert res == wanted - -- cgit v1.2.1 From 903c0d6a3bda96a0b193cc6efd2f8e868d4d82e2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 1 Jan 2015 17:35:05 -0500 Subject: Use namespacing for easier reading --- setuptools/tests/test_build_ext.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index a92e53ae..32e4ad40 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -1,7 +1,8 @@ """build_ext tests """ import unittest -from distutils.command.build_ext import build_ext as distutils_build_ext +import distutils.command.build_ext as orig + from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution @@ -15,5 +16,5 @@ class TestBuildExtTest(unittest.TestCase): cmd = build_ext(dist) cmd.ext_map['foo/bar'] = '' res = cmd.get_ext_filename('foo') - wanted = distutils_build_ext.get_ext_filename(cmd, 'foo') + wanted = orig.build_ext.get_ext_filename(cmd, 'foo') assert res == wanted -- cgit v1.2.1 From 615fc93eba554dba65b3545ead2405014e2a4af8 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 1 Jan 2015 17:35:37 -0500 Subject: Remodel comment as docstring. --- setuptools/tests/test_build_ext.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 32e4ad40..cc8a35e5 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -9,9 +9,11 @@ from setuptools.dist import Distribution class TestBuildExtTest(unittest.TestCase): def test_get_ext_filename(self): - # setuptools needs to give back the same - # result than distutils, even if the fullname - # is not in ext_map + """ + Setuptools needs to give back the same + result as distutils, even if the fullname + is not in ext_map. + """ dist = Distribution() cmd = build_ext(dist) cmd.ext_map['foo/bar'] = '' -- cgit v1.2.1 From 359a80897decd64a0d997005dc7cb731fc294133 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 1 Jan 2015 17:36:29 -0500 Subject: Use pytest for test discovery in build_ext --- setuptools/tests/test_build_ext.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index cc8a35e5..3f356aca 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -1,12 +1,11 @@ """build_ext tests """ -import unittest import distutils.command.build_ext as orig from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution -class TestBuildExtTest(unittest.TestCase): +class TestBuildExt: def test_get_ext_filename(self): """ -- cgit v1.2.1 From 64a3d8b243a2c41dc43b29567652518f1b08992d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Thu, 1 Jan 2015 17:36:49 -0500 Subject: Remove superfluous comment --- setuptools/tests/test_build_ext.py | 3 --- 1 file changed, 3 deletions(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 3f356aca..0719ba44 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -1,12 +1,9 @@ -"""build_ext tests -""" import distutils.command.build_ext as orig from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution class TestBuildExt: - def test_get_ext_filename(self): """ Setuptools needs to give back the same -- cgit v1.2.1 From 6d11e88f938f09ef16db4c6064b6e74acba4db1d Mon Sep 17 00:00:00 2001 From: stepshal Date: Tue, 12 Jul 2016 22:00:43 +0700 Subject: Fix quantity of blank lines after code object. --- setuptools/tests/test_build_ext.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 0719ba44..5168ebf0 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -3,7 +3,9 @@ import distutils.command.build_ext as orig from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution + class TestBuildExt: + def test_get_ext_filename(self): """ Setuptools needs to give back the same -- cgit v1.2.1 From a2605b297c147a1ad54078181d32fe369fa4f37d Mon Sep 17 00:00:00 2001 From: Daniel Holth Date: Wed, 3 Aug 2016 21:55:39 -0400 Subject: use abi3 extension if Extension().is_abi3 --- setuptools/tests/test_build_ext.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 5168ebf0..e0f2e73b 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -1,8 +1,10 @@ +import sys import distutils.command.build_ext as orig +from distutils.sysconfig import get_config_var from setuptools.command.build_ext import build_ext from setuptools.dist import Distribution - +from setuptools.extension import Extension class TestBuildExt: @@ -18,3 +20,19 @@ class TestBuildExt: res = cmd.get_ext_filename('foo') wanted = orig.build_ext.get_ext_filename(cmd, 'foo') assert res == wanted + + def test_abi3_filename(self): + """ + Filename needs to be loadable by several versions + of Python 3 if 'is_abi3' is truthy on Extension() + """ + dist = Distribution(dict(ext_modules=[Extension('spam.eggs', [], is_abi3=True)])) + cmd = build_ext(dist) + res = cmd.get_ext_filename('spam.eggs') + + if sys.version_info[0] == 2: + assert res.endswith(get_config_var('SO')) + elif sys.platform == 'win32': + assert res.endswith('eggs.pyd') + else: + assert 'abi3' in res \ No newline at end of file -- cgit v1.2.1 From dab253cb72eb7c098393f985e32585e079607f66 Mon Sep 17 00:00:00 2001 From: Daniel Holth Date: Fri, 5 Aug 2016 07:45:09 -0400 Subject: call finalize_options in test --- setuptools/tests/test_build_ext.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index e0f2e73b..c71aadca 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -2,7 +2,7 @@ import sys import distutils.command.build_ext as orig from distutils.sysconfig import get_config_var -from setuptools.command.build_ext import build_ext +from setuptools.command.build_ext import build_ext, get_abi3_suffix from setuptools.dist import Distribution from setuptools.extension import Extension @@ -26,8 +26,13 @@ class TestBuildExt: Filename needs to be loadable by several versions of Python 3 if 'is_abi3' is truthy on Extension() """ - dist = Distribution(dict(ext_modules=[Extension('spam.eggs', [], is_abi3=True)])) + print(get_abi3_suffix()) + + extension = Extension('spam.eggs', ['eggs.c'], is_abi3=True) + dist = Distribution(dict(ext_modules=[extension])) cmd = build_ext(dist) + cmd.finalize_options() + assert 'spam.eggs' in cmd.ext_map res = cmd.get_ext_filename('spam.eggs') if sys.version_info[0] == 2: -- cgit v1.2.1 From 702a4277768f0781e3d0a4cf770d29621f7f2cc3 Mon Sep 17 00:00:00 2001 From: Daniel Holth Date: Fri, 5 Aug 2016 07:55:57 -0400 Subject: rename is_abi3 to py_limited_api --- setuptools/tests/test_build_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index c71aadca..100869f6 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -28,7 +28,7 @@ class TestBuildExt: """ print(get_abi3_suffix()) - extension = Extension('spam.eggs', ['eggs.c'], is_abi3=True) + extension = Extension('spam.eggs', ['eggs.c'], py_limited_api=True) dist = Distribution(dict(ext_modules=[extension])) cmd = build_ext(dist) cmd.finalize_options() -- cgit v1.2.1 From 0a3f850b3bc6c888f0f8810e453e664f9fd320f6 Mon Sep 17 00:00:00 2001 From: Daniel Holth Date: Fri, 5 Aug 2016 08:01:58 -0400 Subject: gate test against get_abi3_suffix() --- setuptools/tests/test_build_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 100869f6..f2e1f59d 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -35,7 +35,7 @@ class TestBuildExt: assert 'spam.eggs' in cmd.ext_map res = cmd.get_ext_filename('spam.eggs') - if sys.version_info[0] == 2: + if sys.version_info[0] == 2 or not get_abi3_suffix(): assert res.endswith(get_config_var('SO')) elif sys.platform == 'win32': assert res.endswith('eggs.pyd') -- cgit v1.2.1 From 2cde914c7bc8c8e5a59f937317d47898b38426e4 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 19 Aug 2016 16:09:06 -0400 Subject: Use six for python major version detection --- setuptools/tests/test_build_ext.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index f2e1f59d..0edc92ec 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -1,7 +1,9 @@ import sys import distutils.command.build_ext as orig - from distutils.sysconfig import get_config_var + +from setuptools.extern import six + from setuptools.command.build_ext import build_ext, get_abi3_suffix from setuptools.dist import Distribution from setuptools.extension import Extension @@ -27,7 +29,7 @@ class TestBuildExt: of Python 3 if 'is_abi3' is truthy on Extension() """ print(get_abi3_suffix()) - + extension = Extension('spam.eggs', ['eggs.c'], py_limited_api=True) dist = Distribution(dict(ext_modules=[extension])) cmd = build_ext(dist) @@ -35,9 +37,9 @@ class TestBuildExt: assert 'spam.eggs' in cmd.ext_map res = cmd.get_ext_filename('spam.eggs') - if sys.version_info[0] == 2 or not get_abi3_suffix(): + if six.PY2 or not get_abi3_suffix(): assert res.endswith(get_config_var('SO')) elif sys.platform == 'win32': assert res.endswith('eggs.pyd') else: - assert 'abi3' in res \ No newline at end of file + assert 'abi3' in res -- cgit v1.2.1 From 08511f5fdfe04a8ea6e3ae73e086e8a29a0a5cd1 Mon Sep 17 00:00:00 2001 From: stepshal Date: Sat, 20 Aug 2016 04:37:32 +0700 Subject: Fix quantity of blank lines after code object, class of function definition. --- setuptools/tests/test_build_ext.py | 1 + 1 file changed, 1 insertion(+) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 0edc92ec..ac002f44 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -8,6 +8,7 @@ from setuptools.command.build_ext import build_ext, get_abi3_suffix from setuptools.dist import Distribution from setuptools.extension import Extension + class TestBuildExt: def test_get_ext_filename(self): -- cgit v1.2.1 From 31bd37c6ac8de9e8c1bacebc2d8e1215df91eb96 Mon Sep 17 00:00:00 2001 From: stepshal Date: Tue, 18 Oct 2016 20:24:35 +0700 Subject: Fix quantity of blank lines. --- setuptools/tests/test_build_ext.py | 1 - 1 file changed, 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index ac002f44..60257154 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -10,7 +10,6 @@ from setuptools.extension import Extension class TestBuildExt: - def test_get_ext_filename(self): """ Setuptools needs to give back the same -- cgit v1.2.1 From ff371f18f0076bc63da05334f7e551c1cc29e10d Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 1 Jan 2017 22:34:28 -0500 Subject: Strip out vendored packages and require them instead. Ref #581. --- setuptools/tests/test_build_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 60257154..59a896d8 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -2,7 +2,7 @@ import sys import distutils.command.build_ext as orig from distutils.sysconfig import get_config_var -from setuptools.extern import six +import six from setuptools.command.build_ext import build_ext, get_abi3_suffix from setuptools.dist import Distribution -- cgit v1.2.1 From 3d0cc355fb5e8012cb8c72f0e25042a5a44f31d6 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Fri, 24 Feb 2017 11:49:51 -0500 Subject: Revert "Merge pull request #933 from pypa/feature/581-depend-not-bundle" This reverts commit 089cdeb489a0fa94d11b7307b54210ef9aa40511, reversing changes made to aaec654d804cb78dbb6391afff721a63f26a71cd. --- setuptools/tests/test_build_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 59a896d8..60257154 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -2,7 +2,7 @@ import sys import distutils.command.build_ext as orig from distutils.sysconfig import get_config_var -import six +from setuptools.extern import six from setuptools.command.build_ext import build_ext, get_abi3_suffix from setuptools.dist import Distribution -- cgit v1.2.1 From f7447817b65c12dfe508249cea019c41ce0dc23f Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Mon, 28 Jan 2019 22:57:20 +0100 Subject: test: add a simple regression test for `build_ext` --- setuptools/tests/test_build_ext.py | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 60257154..3dc87ca3 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -8,6 +8,10 @@ from setuptools.command.build_ext import build_ext, get_abi3_suffix from setuptools.dist import Distribution from setuptools.extension import Extension +from . import environment +from .files import build_files +from .textwrap import DALS + class TestBuildExt: def test_get_ext_filename(self): @@ -43,3 +47,69 @@ class TestBuildExt: assert res.endswith('eggs.pyd') else: assert 'abi3' in res + + +def test_build_ext_config_handling(tmpdir_cwd): + files = { + 'setup.py': DALS( + """ + from setuptools import Extension, setup + setup( + name='foo', + version='0.0.0', + ext_modules=[Extension('foo', ['foo.c'])], + ) + """), + 'foo.c': DALS( + """ + #include "Python.h" + + #if PY_MAJOR_VERSION >= 3 + + static struct PyModuleDef moduledef = { + PyModuleDef_HEAD_INIT, + "foo", + NULL, + 0, + NULL, + NULL, + NULL, + NULL, + NULL + }; + + #define INITERROR return NULL + + PyMODINIT_FUNC PyInit_foo(void) + + #else + + #define INITERROR return + + void initfoo(void) + + #endif + { + #if PY_MAJOR_VERSION >= 3 + PyObject *module = PyModule_Create(&moduledef); + #else + PyObject *module = Py_InitModule("extension", NULL); + #endif + if (module == NULL) + INITERROR; + #if PY_MAJOR_VERSION >= 3 + return module; + #endif + } + """), + 'setup.cfg': DALS( + """ + [build] + build-base = foo_build + """), + } + build_files(files) + code, output = environment.run_setup_py( + cmd=['build'], data_stream=(0, 2), + ) + assert code == 0, '\nSTDOUT:\n%s\nSTDERR:\n%s' % output -- cgit v1.2.1 From d9998e6281cbf4bb90cfd8c90e7f34b4ea3a350d Mon Sep 17 00:00:00 2001 From: mattip Date: Mon, 29 Jun 2020 20:00:24 +0300 Subject: fix test for deprecation warning --- setuptools/tests/test_build_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 3dc87ca3..2ef8521d 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -42,7 +42,7 @@ class TestBuildExt: res = cmd.get_ext_filename('spam.eggs') if six.PY2 or not get_abi3_suffix(): - assert res.endswith(get_config_var('SO')) + assert res.endswith(get_config_var('EXT_SUFFIX')) elif sys.platform == 'win32': assert res.endswith('eggs.pyd') else: -- cgit v1.2.1 From fb7ab81a3d080422687bad71f9ae9d36eeefbee2 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sun, 16 Aug 2020 00:29:24 -0400 Subject: Remove Python 2 compatibility --- setuptools/tests/test_build_ext.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 2ef8521d..838fdb42 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -2,8 +2,6 @@ import sys import distutils.command.build_ext as orig from distutils.sysconfig import get_config_var -from setuptools.extern import six - from setuptools.command.build_ext import build_ext, get_abi3_suffix from setuptools.dist import Distribution from setuptools.extension import Extension @@ -41,7 +39,7 @@ class TestBuildExt: assert 'spam.eggs' in cmd.ext_map res = cmd.get_ext_filename('spam.eggs') - if six.PY2 or not get_abi3_suffix(): + if not get_abi3_suffix(): assert res.endswith(get_config_var('EXT_SUFFIX')) elif sys.platform == 'win32': assert res.endswith('eggs.pyd') -- cgit v1.2.1 From 5c57b5cc1e1d247fec64858d8cc4e93b5ffb11a3 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 20 Feb 2021 12:31:39 -0500 Subject: Switch to jaraco.path for building files --- setuptools/tests/test_build_ext.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 838fdb42..be03893a 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -2,12 +2,13 @@ import sys import distutils.command.build_ext as orig from distutils.sysconfig import get_config_var +from jaraco import path + from setuptools.command.build_ext import build_ext, get_abi3_suffix from setuptools.dist import Distribution from setuptools.extension import Extension from . import environment -from .files import build_files from .textwrap import DALS @@ -106,7 +107,7 @@ def test_build_ext_config_handling(tmpdir_cwd): build-base = foo_build """), } - build_files(files) + path.build(files) code, output = environment.run_setup_py( cmd=['build'], data_stream=(0, 2), ) -- cgit v1.2.1 From d027d6d2140daf87079dd3bd186585a5b063269e Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Tue, 2 Mar 2021 20:13:06 -0500 Subject: Modify existing tests to be compatible with future underscore change --- setuptools/tests/test_build_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index be03893a..b6deebe4 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -104,7 +104,7 @@ def test_build_ext_config_handling(tmpdir_cwd): 'setup.cfg': DALS( """ [build] - build-base = foo_build + build_base = foo_build """), } path.build(files) -- cgit v1.2.1 From 1eb36f2c1ee3bc42aa386291518bf62a97276155 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Fri, 9 Jul 2021 22:45:51 +0100 Subject: Fixes #2722: Adds an environment variable SETUPTOOLS_EXT_SUFFIX to override the suffix inferred from the host Python runtime. --- setuptools/tests/test_build_ext.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index b6deebe4..5286358e 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -1,3 +1,4 @@ +import os import sys import distutils.command.build_ext as orig from distutils.sysconfig import get_config_var @@ -47,6 +48,31 @@ class TestBuildExt: else: assert 'abi3' in res + def test_ext_suffix_override(self): + """ + SETUPTOOLS_EXT_SUFFIX variable always overrides + default extension options. + """ + dist = Distribution() + cmd = build_ext(dist) + cmd.ext_map['for_abi3'] = ext = Extension( + 'for_abi3', + ['s.c'], + # Override shouldn't affect abi3 modules + py_limited_api=True, + ) + # Mock value needed to pass tests + ext._links_to_dynamic = False + expect = cmd.get_ext_filename('for_abi3') + try: + os.environ['SETUPTOOLS_EXT_SUFFIX'] = '.test-suffix' + res = cmd.get_ext_filename('normal') + assert 'normal.test-suffix' == res + res = cmd.get_ext_filename('for_abi3') + assert expect == res + finally: + del os.environ['SETUPTOOLS_EXT_SUFFIX'] + def test_build_ext_config_handling(tmpdir_cwd): files = { -- cgit v1.2.1 From 902f0a9b1d4eb39279b237da3950338e8bf20bfe Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 12 Jul 2021 16:31:12 +0100 Subject: Override PyPy case in test --- setuptools/tests/test_build_ext.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 5286358e..0248c5aa 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -13,6 +13,9 @@ from . import environment from .textwrap import DALS +IS_PYPY = '__pypy__' in sys.builtin_module_names + + class TestBuildExt: def test_get_ext_filename(self): """ @@ -63,7 +66,14 @@ class TestBuildExt: ) # Mock value needed to pass tests ext._links_to_dynamic = False - expect = cmd.get_ext_filename('for_abi3') + + if not IS_PYPY: + expect = cmd.get_ext_filename('for_abi3') + else: + # PyPy builds do not use ABI3 tag, so they will + # also get the overridden suffix. + expect = 'for_abi3.test_suffix' + try: os.environ['SETUPTOOLS_EXT_SUFFIX'] = '.test-suffix' res = cmd.get_ext_filename('normal') -- cgit v1.2.1 From dfc843d36099d1fd13e471c4b0ace5cdd5043167 Mon Sep 17 00:00:00 2001 From: Steve Dower Date: Mon, 12 Jul 2021 17:48:15 +0100 Subject: Fix extension in test --- setuptools/tests/test_build_ext.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'setuptools/tests/test_build_ext.py') diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index 0248c5aa..3177a2cd 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -72,7 +72,7 @@ class TestBuildExt: else: # PyPy builds do not use ABI3 tag, so they will # also get the overridden suffix. - expect = 'for_abi3.test_suffix' + expect = 'for_abi3.test-suffix' try: os.environ['SETUPTOOLS_EXT_SUFFIX'] = '.test-suffix' -- cgit v1.2.1