summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEzio Melotti <ezio.melotti@gmail.com>2013-08-08 15:18:26 +0300
committerEzio Melotti <ezio.melotti@gmail.com>2013-08-08 15:18:26 +0300
commit5cc06fde432e4a66aacac33d62947ad20f505c99 (patch)
tree20e48ad9bf50b8c5fbb0c1447b11e86bd5e3c711
parenta27b83ad2d3480ba7c20286d719025ef32100f75 (diff)
parent66f2ea042acf792bf6ff432f409628e1cec99e43 (diff)
downloadcpython-git-5cc06fde432e4a66aacac33d62947ad20f505c99.tar.gz
#18273: merge with 3.3.
-rw-r--r--Lib/test/test_json.py17
-rw-r--r--Lib/test/test_json/__init__.py (renamed from Lib/test/json_tests/__init__.py)13
-rw-r--r--Lib/test/test_json/__main__.py4
-rw-r--r--Lib/test/test_json/test_decode.py (renamed from Lib/test/json_tests/test_decode.py)2
-rw-r--r--Lib/test/test_json/test_default.py (renamed from Lib/test/json_tests/test_default.py)2
-rw-r--r--Lib/test/test_json/test_dump.py (renamed from Lib/test/json_tests/test_dump.py)2
-rw-r--r--Lib/test/test_json/test_encode_basestring_ascii.py (renamed from Lib/test/json_tests/test_encode_basestring_ascii.py)2
-rw-r--r--Lib/test/test_json/test_fail.py (renamed from Lib/test/json_tests/test_fail.py)2
-rw-r--r--Lib/test/test_json/test_float.py (renamed from Lib/test/json_tests/test_float.py)2
-rw-r--r--Lib/test/test_json/test_indent.py (renamed from Lib/test/json_tests/test_indent.py)2
-rw-r--r--Lib/test/test_json/test_pass1.py (renamed from Lib/test/json_tests/test_pass1.py)2
-rw-r--r--Lib/test/test_json/test_pass2.py (renamed from Lib/test/json_tests/test_pass2.py)2
-rw-r--r--Lib/test/test_json/test_pass3.py (renamed from Lib/test/json_tests/test_pass3.py)2
-rw-r--r--Lib/test/test_json/test_recursion.py (renamed from Lib/test/json_tests/test_recursion.py)2
-rw-r--r--Lib/test/test_json/test_scanstring.py (renamed from Lib/test/json_tests/test_scanstring.py)2
-rw-r--r--Lib/test/test_json/test_separators.py (renamed from Lib/test/json_tests/test_separators.py)2
-rw-r--r--Lib/test/test_json/test_speedups.py (renamed from Lib/test/json_tests/test_speedups.py)2
-rw-r--r--Lib/test/test_json/test_tool.py (renamed from Lib/test/json_tests/test_tool.py)0
-rw-r--r--Lib/test/test_json/test_unicode.py (renamed from Lib/test/json_tests/test_unicode.py)2
-rw-r--r--Makefile.pre.in2
-rw-r--r--Misc/NEWS3
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
index 41ff8974fc..0000000000
--- 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
index 779c7a46b3..f994f9b589 100644
--- a/Lib/test/json_tests/__init__.py
+++ b/Lib/test/test_json/__init__.py
@@ -44,12 +44,12 @@ class TestCTest(CTest):
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 @@ def additional_tests():
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
index 0000000000..e756afbc7a
--- /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
index 15a427f719..d23e285909 100644
--- 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
index 672c753fbf..9b8325e9c3 100644
--- 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
index 237ee35b26..af1925888d 100644
--- 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
index bfca69d18d..480afd686e 100644
--- 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
index 5b652e864a..7caafdbddd 100644
--- 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
index 38ef7e94b3..d0c7214334 100644
--- 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
index 4eb4f892d0..e07856f33c 100644
--- 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
index 52445f396e..15e64b0aea 100644
--- 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
index eee6383382..35075249e3 100644
--- 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
index 228eee8adb..cd0cf170d2 100644
--- 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
index 192ed9cf40..1a76254d01 100644
--- 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
index 426c8dd3bb..2e3a291358 100644
--- 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
index a01b38c080..84a2be9ae0 100644
--- 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
index 5c24c0580b..109a2466c2 100644
--- 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
index 0c39e56837..0c39e56837 100644
--- a/Lib/test/json_tests/test_tool.py
+++ b/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
index f226aa6f03..c7cc8a7e92 100644
--- 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
index 8103124f4f..881d945427 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -1079,7 +1079,7 @@ LIBSUBDIRS= tkinter tkinter/test tkinter/test/test_tkinter \
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
index f9129b6e52..0772cd2e18 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -634,6 +634,9 @@ Library
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