#22980 Adds platform and version tags to .pyd files

This commit is contained in:
Steve Dower 2014-12-15 20:45:23 -08:00
parent 09bd9ec9b3
commit 03a144bb6a
5 changed files with 52 additions and 4 deletions

View file

@ -2,9 +2,11 @@ from . import util as test_util
machinery = test_util.import_importlib('importlib.machinery')
import os
import re
import sys
import unittest
from test import support
from distutils.util import get_platform
from contextlib import contextmanager
from .util import temp_module
@ -83,3 +85,25 @@ class WindowsRegistryFinderTests:
(Frozen_WindowsRegistryFinderTests,
Source_WindowsRegistryFinderTests
) = test_util.test_both(WindowsRegistryFinderTests, machinery=machinery)
@unittest.skipUnless(sys.platform.startswith('win'), 'requires Windows')
class WindowsExtensionSuffixTests:
def test_tagged_suffix(self):
suffixes = self.machinery.EXTENSION_SUFFIXES
expected_tag = ".cp{0.major}{0.minor}-{1}.pyd".format(sys.version_info,
re.sub('[^a-zA-Z0-9]', '_', get_platform()))
try:
untagged_i = suffixes.index(".pyd")
except ValueError:
untagged_i = suffixes.index("_d.pyd")
expected_tag = "_d" + expected_tag
self.assertIn(expected_tag, suffixes)
# Ensure the tags are in the correct order
tagged_i = suffixes.index(expected_tag)
self.assertLess(tagged_i, untagged_i)
(Frozen_WindowsExtensionSuffixTests,
Source_WindowsExtensionSuffixTests
) = test_util.test_both(WindowsExtensionSuffixTests, machinery=machinery)