summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-02-27 08:01:06 (GMT)
committerEzio Melotti <ezio.melotti@gmail.com>2013-02-27 08:01:06 (GMT)
commit28050255cca492295df75b9649dddd4d95a0940c (patch)
tree91f99c8d7faf37db8502d72152c2194a71cbaa45
parent742c5961dd09e4e674feef10c2bd43191cdf828e (diff)
parent1ed6be3793cf7e0964a8c345967064e915e13b78 (diff)
downloadcpython-28050255cca492295df75b9649dddd4d95a0940c.zip
cpython-28050255cca492295df75b9649dddd4d95a0940c.tar.gz
cpython-28050255cca492295df75b9649dddd4d95a0940c.tar.bz2
#17303: merge with 3.3.
-rw-r--r--Lib/test/test_future.py24
-rw-r--r--Lib/test/test_future3.py6
-rw-r--r--Lib/test/test_future4.py6
-rw-r--r--Lib/test/test_future5.py4
-rw-r--r--Misc/NEWS3
5 files changed, 18 insertions, 25 deletions
diff --git a/Lib/test/test_future.py b/Lib/test/test_future.py
index 3a25eb1..a0c156f 100644
--- a/Lib/test/test_future.py
+++ b/Lib/test/test_future.py
@@ -13,18 +13,18 @@ def get_error_location(msg):
class FutureTest(unittest.TestCase):
def test_future1(self):
- support.unload('future_test1')
- from test import future_test1
- self.assertEqual(future_test1.result, 6)
+ with support.CleanImport('future_test1'):
+ from test import future_test1
+ self.assertEqual(future_test1.result, 6)
def test_future2(self):
- support.unload('future_test2')
- from test import future_test2
- self.assertEqual(future_test2.result, 6)
+ with support.CleanImport('future_test2'):
+ from test import future_test2
+ self.assertEqual(future_test2.result, 6)
def test_future3(self):
- support.unload('test_future3')
- from test import test_future3
+ with support.CleanImport('test_future3'):
+ from test import test_future3
def test_badfuture3(self):
try:
@@ -103,8 +103,8 @@ class FutureTest(unittest.TestCase):
self.fail("syntax error didn't occur")
def test_multiple_features(self):
- support.unload("test.test_future5")
- from test import test_future5
+ with support.CleanImport("test.test_future5"):
+ from test import test_future5
def test_unicode_literals_exec(self):
scope = {}
@@ -112,8 +112,6 @@ class FutureTest(unittest.TestCase):
self.assertIsInstance(scope["x"], str)
-def test_main():
- support.run_unittest(FutureTest)
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_future3.py b/Lib/test/test_future3.py
index b1552a5..09f1c78 100644
--- a/Lib/test/test_future3.py
+++ b/Lib/test/test_future3.py
@@ -2,7 +2,6 @@ from __future__ import nested_scopes
from __future__ import division
import unittest
-from test import support
x = 2
def nester():
@@ -23,8 +22,5 @@ class TestFuture(unittest.TestCase):
def test_nested_scopes(self):
self.assertEqual(nester(), 3)
-def test_main():
- support.run_unittest(TestFuture)
-
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_future4.py b/Lib/test/test_future4.py
index c32f27f..413dd4d 100644
--- a/Lib/test/test_future4.py
+++ b/Lib/test/test_future4.py
@@ -1,10 +1,6 @@
from __future__ import unicode_literals
import unittest
-from test import support
-
-def test_main():
- pass
if __name__ == "__main__":
- test_main()
+ unittest.main()
diff --git a/Lib/test/test_future5.py b/Lib/test/test_future5.py
index ed03a07..b44b97e 100644
--- a/Lib/test/test_future5.py
+++ b/Lib/test/test_future5.py
@@ -17,5 +17,5 @@ class TestMultipleFeatures(unittest.TestCase):
self.assertEqual(s.getvalue(), "foo\n")
-def test_main():
- support.run_unittest(TestMultipleFeatures)
+if __name__ == '__main__':
+ unittest.main()
diff --git a/Misc/NEWS b/Misc/NEWS
index 8917b53..60dda93 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -893,6 +893,9 @@ Tests
- Issue #16836: Enable IPv6 support even if IPv6 is disabled on the build host.
+- Issue #17303: test_future* now work with unittest test discovery.
+ Patch by Zachary Ware.
+
- Issue #17163: test_file now works with unittest test discovery.
Patch by Zachary Ware.