mirror of https://github.com/python/cpython
Stop using test_support.verify().
This commit is contained in:
parent
9475db7662
commit
80e8c998a2
|
@ -1,7 +1,5 @@
|
||||||
import unittest
|
import unittest
|
||||||
from test import test_support
|
from test.test_support import verbose, run_unittest
|
||||||
|
|
||||||
from test.test_support import verify, verbose
|
|
||||||
import sys
|
import sys
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
@ -22,15 +20,15 @@ class AllTest(unittest.TestCase):
|
||||||
# Silent fail here seems the best route since some modules
|
# Silent fail here seems the best route since some modules
|
||||||
# may not be available in all environments.
|
# may not be available in all environments.
|
||||||
return
|
return
|
||||||
verify(hasattr(sys.modules[modname], "__all__"),
|
self.failUnless(hasattr(sys.modules[modname], "__all__"),
|
||||||
"%s has no __all__ attribute" % modname)
|
"%s has no __all__ attribute" % modname)
|
||||||
names = {}
|
names = {}
|
||||||
exec "from %s import *" % modname in names
|
exec "from %s import *" % modname in names
|
||||||
if names.has_key("__builtins__"):
|
if "__builtins__" in names:
|
||||||
del names["__builtins__"]
|
del names["__builtins__"]
|
||||||
keys = set(names)
|
keys = set(names)
|
||||||
all = set(sys.modules[modname].__all__)
|
all = set(sys.modules[modname].__all__)
|
||||||
verify(keys==all, "%s != %s" % (keys, all))
|
self.assertEqual(keys, all)
|
||||||
|
|
||||||
def test_all(self):
|
def test_all(self):
|
||||||
if not sys.platform.startswith('java'):
|
if not sys.platform.startswith('java'):
|
||||||
|
@ -181,7 +179,7 @@ class AllTest(unittest.TestCase):
|
||||||
|
|
||||||
|
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(AllTest)
|
run_unittest(AllTest)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
Loading…
Reference in New Issue