[Python-checkins] cpython (merge 3.3 -> default): #18273: merge with 3.3.
ezio.melotti
python-checkins at python.org
Thu Aug 8 14:31:49 CEST 2013
http://hg.python.org/cpython/rev/f7ed301e7199
changeset: 85065:f7ed301e7199
parent: 85063:f871f8662509
parent: 85064:95cf8640b271
user: Ezio Melotti <ezio.melotti at gmail.com>
date: Thu Aug 08 15:18:26 2013 +0300
summary:
#18273: merge with 3.3.
files:
Lib/test/test_json.py | 17 ----------
Lib/test/json_tests/__init__.py | 13 +------
Lib/test/test_json/__main__.py | 4 ++
Lib/test/json_tests/test_decode.py | 2 +-
Lib/test/json_tests/test_default.py | 2 +-
Lib/test/json_tests/test_dump.py | 2 +-
Lib/test/json_tests/test_encode_basestring_ascii.py | 2 +-
Lib/test/json_tests/test_fail.py | 2 +-
Lib/test/json_tests/test_float.py | 2 +-
Lib/test/json_tests/test_indent.py | 2 +-
Lib/test/json_tests/test_pass1.py | 2 +-
Lib/test/json_tests/test_pass2.py | 2 +-
Lib/test/json_tests/test_pass3.py | 2 +-
Lib/test/json_tests/test_recursion.py | 2 +-
Lib/test/json_tests/test_scanstring.py | 2 +-
Lib/test/json_tests/test_separators.py | 2 +-
Lib/test/json_tests/test_speedups.py | 2 +-
Lib/test/json_tests/test_tool.py | 0
Lib/test/json_tests/test_unicode.py | 2 +-
Makefile.pre.in | 2 +-
Misc/NEWS | 3 +
21 files changed, 25 insertions(+), 44 deletions(-)
diff --git a/Lib/test/test_json.py b/Lib/test/test_json.py
deleted file mode 100644
--- a/Lib/test/test_json.py
+++ /dev/null
@@ -1,17 +0,0 @@
-"""Tests for json.
-
-The tests for json are defined in the json.tests package;
-the test_suite() function there returns a test suite that's ready to
-be run.
-"""
-
-from test import json_tests
-import test.support
-
-
-def test_main():
- test.support.run_unittest(json_tests.test_suite())
-
-
-if __name__ == "__main__":
- test_main()
diff --git a/Lib/test/json_tests/__init__.py b/Lib/test/test_json/__init__.py
rename from Lib/test/json_tests/__init__.py
rename to Lib/test/test_json/__init__.py
--- a/Lib/test/json_tests/__init__.py
+++ b/Lib/test/test_json/__init__.py
@@ -44,12 +44,12 @@
here = os.path.dirname(__file__)
-def test_suite():
+def load_tests(*args):
suite = additional_tests()
loader = unittest.TestLoader()
for fn in os.listdir(here):
if fn.startswith("test") and fn.endswith(".py"):
- modname = "test.json_tests." + fn[:-3]
+ modname = "test.test_json." + fn[:-3]
__import__(modname)
module = sys.modules[modname]
suite.addTests(loader.loadTestsFromModule(module))
@@ -62,12 +62,3 @@
suite.addTest(TestPyTest('test_pyjson'))
suite.addTest(TestCTest('test_cjson'))
return suite
-
-def main():
- suite = test_suite()
- runner = unittest.TextTestRunner()
- runner.run(suite)
-
-if __name__ == '__main__':
- sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))))
- main()
diff --git a/Lib/test/test_json/__main__.py b/Lib/test/test_json/__main__.py
new file mode 100644
--- /dev/null
+++ b/Lib/test/test_json/__main__.py
@@ -0,0 +1,4 @@
+import unittest
+from test.test_json import load_tests
+
+unittest.main()
diff --git a/Lib/test/json_tests/test_decode.py b/Lib/test/test_json/test_decode.py
rename from Lib/test/json_tests/test_decode.py
rename to Lib/test/test_json/test_decode.py
--- a/Lib/test/json_tests/test_decode.py
+++ b/Lib/test/test_json/test_decode.py
@@ -1,7 +1,7 @@
import decimal
from io import StringIO
from collections import OrderedDict
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
class TestDecode:
diff --git a/Lib/test/json_tests/test_default.py b/Lib/test/test_json/test_default.py
rename from Lib/test/json_tests/test_default.py
rename to Lib/test/test_json/test_default.py
--- a/Lib/test/json_tests/test_default.py
+++ b/Lib/test/test_json/test_default.py
@@ -1,4 +1,4 @@
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
class TestDefault:
diff --git a/Lib/test/json_tests/test_dump.py b/Lib/test/test_json/test_dump.py
rename from Lib/test/json_tests/test_dump.py
rename to Lib/test/test_json/test_dump.py
--- a/Lib/test/json_tests/test_dump.py
+++ b/Lib/test/test_json/test_dump.py
@@ -1,5 +1,5 @@
from io import StringIO
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
from test.support import bigmemtest, _1G
diff --git a/Lib/test/json_tests/test_encode_basestring_ascii.py b/Lib/test/test_json/test_encode_basestring_ascii.py
rename from Lib/test/json_tests/test_encode_basestring_ascii.py
rename to Lib/test/test_json/test_encode_basestring_ascii.py
--- a/Lib/test/json_tests/test_encode_basestring_ascii.py
+++ b/Lib/test/test_json/test_encode_basestring_ascii.py
@@ -1,5 +1,5 @@
from collections import OrderedDict
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
CASES = [
diff --git a/Lib/test/json_tests/test_fail.py b/Lib/test/test_json/test_fail.py
rename from Lib/test/json_tests/test_fail.py
rename to Lib/test/test_json/test_fail.py
--- a/Lib/test/json_tests/test_fail.py
+++ b/Lib/test/test_json/test_fail.py
@@ -1,4 +1,4 @@
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
import re
# 2007-10-05
diff --git a/Lib/test/json_tests/test_float.py b/Lib/test/test_json/test_float.py
rename from Lib/test/json_tests/test_float.py
rename to Lib/test/test_json/test_float.py
--- a/Lib/test/json_tests/test_float.py
+++ b/Lib/test/test_json/test_float.py
@@ -1,5 +1,5 @@
import math
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
class TestFloat:
diff --git a/Lib/test/json_tests/test_indent.py b/Lib/test/test_json/test_indent.py
rename from Lib/test/json_tests/test_indent.py
rename to Lib/test/test_json/test_indent.py
--- a/Lib/test/json_tests/test_indent.py
+++ b/Lib/test/test_json/test_indent.py
@@ -1,6 +1,6 @@
import textwrap
from io import StringIO
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
class TestIndent:
diff --git a/Lib/test/json_tests/test_pass1.py b/Lib/test/test_json/test_pass1.py
rename from Lib/test/json_tests/test_pass1.py
rename to Lib/test/test_json/test_pass1.py
--- a/Lib/test/json_tests/test_pass1.py
+++ b/Lib/test/test_json/test_pass1.py
@@ -1,4 +1,4 @@
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
# from http://json.org/JSON_checker/test/pass1.json
diff --git a/Lib/test/json_tests/test_pass2.py b/Lib/test/test_json/test_pass2.py
rename from Lib/test/json_tests/test_pass2.py
rename to Lib/test/test_json/test_pass2.py
--- a/Lib/test/json_tests/test_pass2.py
+++ b/Lib/test/test_json/test_pass2.py
@@ -1,4 +1,4 @@
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
# from http://json.org/JSON_checker/test/pass2.json
diff --git a/Lib/test/json_tests/test_pass3.py b/Lib/test/test_json/test_pass3.py
rename from Lib/test/json_tests/test_pass3.py
rename to Lib/test/test_json/test_pass3.py
--- a/Lib/test/json_tests/test_pass3.py
+++ b/Lib/test/test_json/test_pass3.py
@@ -1,4 +1,4 @@
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
# from http://json.org/JSON_checker/test/pass3.json
diff --git a/Lib/test/json_tests/test_recursion.py b/Lib/test/test_json/test_recursion.py
rename from Lib/test/json_tests/test_recursion.py
rename to Lib/test/test_json/test_recursion.py
--- a/Lib/test/json_tests/test_recursion.py
+++ b/Lib/test/test_json/test_recursion.py
@@ -1,4 +1,4 @@
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
class JSONTestObject:
diff --git a/Lib/test/json_tests/test_scanstring.py b/Lib/test/test_json/test_scanstring.py
rename from Lib/test/json_tests/test_scanstring.py
rename to Lib/test/test_json/test_scanstring.py
--- a/Lib/test/json_tests/test_scanstring.py
+++ b/Lib/test/test_json/test_scanstring.py
@@ -1,5 +1,5 @@
import sys
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
class TestScanstring:
diff --git a/Lib/test/json_tests/test_separators.py b/Lib/test/test_json/test_separators.py
rename from Lib/test/json_tests/test_separators.py
rename to Lib/test/test_json/test_separators.py
--- a/Lib/test/json_tests/test_separators.py
+++ b/Lib/test/test_json/test_separators.py
@@ -1,5 +1,5 @@
import textwrap
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
class TestSeparators:
diff --git a/Lib/test/json_tests/test_speedups.py b/Lib/test/test_json/test_speedups.py
rename from Lib/test/json_tests/test_speedups.py
rename to Lib/test/test_json/test_speedups.py
--- a/Lib/test/json_tests/test_speedups.py
+++ b/Lib/test/test_json/test_speedups.py
@@ -1,4 +1,4 @@
-from test.json_tests import CTest
+from test.test_json import CTest
class TestSpeedups(CTest):
diff --git a/Lib/test/json_tests/test_tool.py b/Lib/test/test_json/test_tool.py
rename from Lib/test/json_tests/test_tool.py
rename to Lib/test/test_json/test_tool.py
diff --git a/Lib/test/json_tests/test_unicode.py b/Lib/test/test_json/test_unicode.py
rename from Lib/test/json_tests/test_unicode.py
rename to Lib/test/test_json/test_unicode.py
--- a/Lib/test/json_tests/test_unicode.py
+++ b/Lib/test/test_json/test_unicode.py
@@ -1,5 +1,5 @@
from collections import OrderedDict
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
class TestUnicode:
diff --git a/Makefile.pre.in b/Makefile.pre.in
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1079,7 +1079,7 @@
test/namespace_pkgs/module_and_namespace_package/a_test \
collections concurrent concurrent/futures encodings \
email email/mime test/test_email test/test_email/data \
- html json test/json_tests http dbm xmlrpc \
+ html json test/test_json http dbm xmlrpc \
sqlite3 sqlite3/test \
logging csv wsgiref urllib \
lib2to3 lib2to3/fixes lib2to3/pgen2 lib2to3/tests \
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -634,6 +634,9 @@
Tests
-----
+- Issue #18273: move the tests in Lib/test/json_tests to Lib/test/test_json
+ and make them discoverable by unittest. Patch by Zachary Ware.
+
- Fix a fcntl test case on KFreeBSD, Debian #708653 (Petr Salinger).
- Issue #18396: Fix spurious test failure in test_signal on Windows when
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list