diff options
author | Barry Warsaw <barry@python.org> | 2018-05-15 18:41:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-15 18:41:13 (GMT) |
commit | 8709b236fc997077d24b4802320db287640f82e2 (patch) | |
tree | 3e6e9f90b4cb37fc7607048ca32eeb9eb0ea3f8a /Lib | |
parent | 389a48ede92bf7965889d554d2cd17b50d6e3d86 (diff) | |
download | cpython-8709b236fc997077d24b4802320db287640f82e2.zip cpython-8709b236fc997077d24b4802320db287640f82e2.tar.gz cpython-8709b236fc997077d24b4802320db287640f82e2.tar.bz2 |
bpo-33465: Use an unlikely to be built-in C extension in a test (#6797)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_import/__init__.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_import/__init__.py b/Lib/test/test_import/__init__.py index c23fac1..fb9453a 100644 --- a/Lib/test/test_import/__init__.py +++ b/Lib/test/test_import/__init__.py @@ -90,13 +90,14 @@ class ImportTests(unittest.TestCase): 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: |