[Python-checkins] bpo-33465: Use an unlikely to be built-in C extension in a test (GH-6797) (#6869)
Barry Warsaw
webhook-mailer at python.org
Tue May 15 17:24:30 EDT 2018
https://github.com/python/cpython/commit/2cdb70ac5df30db021417ab71a327d9b4322de13
commit: 2cdb70ac5df30db021417ab71a327d9b4322de13
branch: 3.7
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: Barry Warsaw <barry at python.org>
date: 2018-05-15T17:24:26-04:00
summary:
bpo-33465: Use an unlikely to be built-in C extension in a test (GH-6797) (#6869)
(cherry picked from commit 8709b236fc997077d24b4802320db287640f82e2)
Co-authored-by: Barry Warsaw <barry at python.org>
files:
M Lib/test/test_import/__init__.py
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py
index 049ee57e58a0..1fc4de11e178 100644
--- a/Lib/test/test_import/__init__.py
+++ b/Lib/test/test_import/__init__.py
@@ -90,13 +90,14 @@ def test_from_import_missing_attr_has_name_and_path(self):
self.assertEqual(cm.exception.path, os.__file__)
self.assertRegex(str(cm.exception), r"cannot import name 'i_dont_exist' from 'os' \(.*os.py\)")
+ @cpython_only
def test_from_import_missing_attr_has_name_and_so_path(self):
- import select
+ import _testcapi
with self.assertRaises(ImportError) as cm:
- from select import i_dont_exist
- self.assertEqual(cm.exception.name, 'select')
- self.assertEqual(cm.exception.path, select.__file__)
- self.assertRegex(str(cm.exception), r"cannot import name 'i_dont_exist' from 'select' \(.*\.(so|pyd)\)")
+ from _testcapi import i_dont_exist
+ self.assertEqual(cm.exception.name, '_testcapi')
+ self.assertEqual(cm.exception.path, _testcapi.__file__)
+ self.assertRegex(str(cm.exception), r"cannot import name 'i_dont_exist' from '_testcapi' \(.*\.(so|pyd)\)")
def test_from_import_missing_attr_has_name(self):
with self.assertRaises(ImportError) as cm:
More information about the Python-checkins
mailing list