aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_build_ext.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-08-19 16:00:56 -0400
committerGitHub <noreply@github.com>2016-08-19 16:00:56 -0400
commit6ae38d0538ceaa9c0360f7f04956acd5e138656d (patch)
treecf69b08b3d42c91165fddba2cc63d836d7db73d8 /setuptools/tests/test_build_ext.py
parent7c32dac163b1d8f1256caf0a4e42ed19ff74d150 (diff)
parentfc6050ad4c1481be0a1aba1f056e76aa8be50039 (diff)
downloadexternal_python_setuptools-6ae38d0538ceaa9c0360f7f04956acd5e138656d.tar.gz
external_python_setuptools-6ae38d0538ceaa9c0360f7f04956acd5e138656d.tar.bz2
external_python_setuptools-6ae38d0538ceaa9c0360f7f04956acd5e138656d.zip
Merge pull request #718 from dholth/master
use abi3 extension if Extension().is_abi3
Diffstat (limited to 'setuptools/tests/test_build_ext.py')
-rw-r--r--setuptools/tests/test_build_ext.py27
1 files changed, 25 insertions, 2 deletions
diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py
index 5168ebf0..f2e1f59d 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 setuptools.command.build_ext import build_ext
+from distutils.sysconfig import get_config_var
+from setuptools.command.build_ext import build_ext, get_abi3_suffix
from setuptools.dist import Distribution
-
+from setuptools.extension import Extension
class TestBuildExt:
@@ -18,3 +20,24 @@ 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()
+ """
+ print(get_abi3_suffix())
+
+ extension = Extension('spam.eggs', ['eggs.c'], py_limited_api=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 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