mirror of https://github.com/python/cpython
Rename test module names for #16421 to don't clash with other tests.
This commit is contained in:
parent
5cb8a31dc4
commit
ef9a43b2c9
|
@ -223,11 +223,11 @@ class ImportTests(unittest.TestCase):
|
||||||
fileobj, pathname, description = imp.find_module(m)
|
fileobj, pathname, description = imp.find_module(m)
|
||||||
fileobj.close()
|
fileobj.close()
|
||||||
mod0 = imp.load_dynamic(m, pathname)
|
mod0 = imp.load_dynamic(m, pathname)
|
||||||
mod1 = imp.load_dynamic('foo', pathname)
|
mod1 = imp.load_dynamic('_testimportmultiple_foo', pathname)
|
||||||
mod2 = imp.load_dynamic('bar', pathname)
|
mod2 = imp.load_dynamic('_testimportmultiple_bar', pathname)
|
||||||
self.assertEqual(mod0.__name__, m)
|
self.assertEqual(mod0.__name__, m)
|
||||||
self.assertEqual(mod1.__name__, 'foo')
|
self.assertEqual(mod1.__name__, '_testimportmultiple_foo')
|
||||||
self.assertEqual(mod2.__name__, 'bar')
|
self.assertEqual(mod2.__name__, '_testimportmultiple_bar')
|
||||||
with self.assertRaises(ImportError):
|
with self.assertRaises(ImportError):
|
||||||
imp.load_dynamic('nonexistent', pathname)
|
imp.load_dynamic('nonexistent', pathname)
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ PyMODINIT_FUNC PyInit__testimportmultiple()
|
||||||
|
|
||||||
static struct PyModuleDef _foomodule = {
|
static struct PyModuleDef _foomodule = {
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
"foo",
|
"_testimportmultiple_foo",
|
||||||
"foo doc",
|
"_testimportmultiple_foo doc",
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -34,15 +34,15 @@ static struct PyModuleDef _foomodule = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC PyInit_foo()
|
PyMODINIT_FUNC PyInit__testimportmultiple_foo()
|
||||||
{
|
{
|
||||||
return PyModule_Create(&_foomodule);
|
return PyModule_Create(&_foomodule);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct PyModuleDef _barmodule = {
|
static struct PyModuleDef _barmodule = {
|
||||||
PyModuleDef_HEAD_INIT,
|
PyModuleDef_HEAD_INIT,
|
||||||
"bar",
|
"_testimportmultiple_bar",
|
||||||
"bar doc",
|
"_testimportmultiple_bar doc",
|
||||||
-1,
|
-1,
|
||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -51,7 +51,7 @@ static struct PyModuleDef _barmodule = {
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
PyMODINIT_FUNC PyInit_bar(){
|
PyMODINIT_FUNC PyInit__testimportmultiple_bar(){
|
||||||
return PyModule_Create(&_barmodule);
|
return PyModule_Create(&_barmodule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue