]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
#18273: move the tests in Lib/test/json_tests to Lib/test/test_json and make them...
authorEzio Melotti <ezio.melotti@gmail.com>
Thu, 8 Aug 2013 12:03:45 +0000 (15:03 +0300)
committerEzio Melotti <ezio.melotti@gmail.com>
Thu, 8 Aug 2013 12:03:45 +0000 (15:03 +0300)
21 files changed:
Lib/test/test_json.py [deleted file]
Lib/test/test_json/__init__.py [moved from Lib/test/json_tests/__init__.py with 87% similarity]
Lib/test/test_json/__main__.py [new file with mode: 0644]
Lib/test/test_json/test_decode.py [moved from Lib/test/json_tests/test_decode.py with 98% similarity]
Lib/test/test_json/test_default.py [moved from Lib/test/json_tests/test_default.py with 85% similarity]
Lib/test/test_json/test_dump.py [moved from Lib/test/json_tests/test_dump.py with 97% similarity]
Lib/test/test_json/test_encode_basestring_ascii.py [moved from Lib/test/json_tests/test_encode_basestring_ascii.py with 98% similarity]
Lib/test/test_json/test_fail.py [moved from Lib/test/json_tests/test_fail.py with 98% similarity]
Lib/test/test_json/test_float.py [moved from Lib/test/json_tests/test_float.py with 96% similarity]
Lib/test/test_json/test_indent.py [moved from Lib/test/json_tests/test_indent.py with 97% similarity]
Lib/test/test_json/test_pass1.py [moved from Lib/test/json_tests/test_pass1.py with 97% similarity]
Lib/test/test_json/test_pass2.py [moved from Lib/test/json_tests/test_pass2.py with 90% similarity]
Lib/test/test_json/test_pass3.py [moved from Lib/test/json_tests/test_pass3.py with 92% similarity]
Lib/test/test_json/test_recursion.py [moved from Lib/test/json_tests/test_recursion.py with 98% similarity]
Lib/test/test_json/test_scanstring.py [moved from Lib/test/json_tests/test_scanstring.py with 98% similarity]
Lib/test/test_json/test_separators.py [moved from Lib/test/json_tests/test_separators.py with 95% similarity]
Lib/test/test_json/test_speedups.py [moved from Lib/test/json_tests/test_speedups.py with 96% similarity]
Lib/test/test_json/test_tool.py [moved from Lib/test/json_tests/test_tool.py with 100% similarity]
Lib/test/test_json/test_unicode.py [moved from Lib/test/json_tests/test_unicode.py with 98% similarity]
Makefile.pre.in
Misc/NEWS

diff --git a/Lib/test/test_json.py b/Lib/test/test_json.py
deleted file mode 100644 (file)
index 41ff897..0000000
+++ /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()
similarity index 87%
rename from Lib/test/json_tests/__init__.py
rename to Lib/test/test_json/__init__.py
index 779c7a46b3de8a149de9743942526b2d13492092..f994f9b5896b04e53e794ae47fb9387b0f5bd3ee 100644 (file)
@@ -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 (file)
index 0000000..e756afb
--- /dev/null
@@ -0,0 +1,4 @@
+import unittest
+from test.test_json import load_tests
+
+unittest.main()
similarity index 98%
rename from Lib/test/json_tests/test_decode.py
rename to Lib/test/test_json/test_decode.py
index 15a427f719b29f88e83b6ee7d971c2b297063f16..d23e2859099646cd3d36e597c264e224498a9086 100644 (file)
@@ -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:
similarity index 85%
rename from Lib/test/json_tests/test_default.py
rename to Lib/test/test_json/test_default.py
index 672c753fbf75c28eab67c3330cc4bd9881890977..9b8325e9c3816b6bfc7fb042fd64ca277bfb3cdf 100644 (file)
@@ -1,4 +1,4 @@
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
 
 
 class TestDefault:
similarity index 97%
rename from Lib/test/json_tests/test_dump.py
rename to Lib/test/test_json/test_dump.py
index 237ee35b264edb0580248ac884df9e120e23180b..af1925888db4ceb0020edbd78225898bfcd01459 100644 (file)
@@ -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
 
similarity index 98%
rename from Lib/test/json_tests/test_encode_basestring_ascii.py
rename to Lib/test/test_json/test_encode_basestring_ascii.py
index bfca69d18db86a0b6e3ec82dbba879800ec55b28..480afd686e453d7178c6b82e264ec9760faca210 100644 (file)
@@ -1,5 +1,5 @@
 from collections import OrderedDict
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
 
 
 CASES = [
similarity index 98%
rename from Lib/test/json_tests/test_fail.py
rename to Lib/test/test_json/test_fail.py
index 7809056a731e5d363aa2fa2f5f027e6f3f545ade..3dd877afdbc06e3778da8daecce79fa97cdc54b0 100644 (file)
@@ -1,4 +1,4 @@
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
 
 # 2007-10-05
 JSONDOCS = [
similarity index 96%
rename from Lib/test/json_tests/test_float.py
rename to Lib/test/test_json/test_float.py
index 38ef7e94b3875fa80d6149ecfff61edb8a166970..d0c7214334d6e5c9ffff99abfa890a59735fdb49 100644 (file)
@@ -1,5 +1,5 @@
 import math
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
 
 
 class TestFloat:
similarity index 97%
rename from Lib/test/json_tests/test_indent.py
rename to Lib/test/test_json/test_indent.py
index 4c706463396d315978c28d19932ec0f979535312..a4d4d201422dc3b67a52d608c9396daca6d36946 100644 (file)
@@ -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:
similarity index 97%
rename from Lib/test/json_tests/test_pass1.py
rename to Lib/test/test_json/test_pass1.py
index 52445f396e077a54b79c8601c0af28c1918e5259..15e64b0aeae70907fbdc41f204ff487c0a828e0a 100644 (file)
@@ -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
similarity index 90%
rename from Lib/test/json_tests/test_pass2.py
rename to Lib/test/test_json/test_pass2.py
index eee6383382c89337f9cb05d258f3a08d3e88a261..35075249e3bc6fe6d8215a92602424a7ae6bc7a0 100644 (file)
@@ -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
similarity index 92%
rename from Lib/test/json_tests/test_pass3.py
rename to Lib/test/test_json/test_pass3.py
index 228eee8adb96110f7063f50f3c0d2afb1796c10f..cd0cf170d275c5684b53b9828a1f7be273d28874 100644 (file)
@@ -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
similarity index 98%
rename from Lib/test/json_tests/test_recursion.py
rename to Lib/test/test_json/test_recursion.py
index 192ed9cf40c1b4c6f7aa99f8369c617a498ff038..1a76254d01b6acffe49bc557a7e06a4727dd7d52 100644 (file)
@@ -1,4 +1,4 @@
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
 
 
 class JSONTestObject:
similarity index 98%
rename from Lib/test/json_tests/test_scanstring.py
rename to Lib/test/test_json/test_scanstring.py
index 426c8dd3bbff44eeecb64b30e2cfae086245600e..2e3a291358c14fc93e6ec89f7362e8d610b8e951 100644 (file)
@@ -1,5 +1,5 @@
 import sys
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
 
 
 class TestScanstring:
similarity index 95%
rename from Lib/test/json_tests/test_separators.py
rename to Lib/test/test_json/test_separators.py
index a01b38c0807deb2e2a692421d3c367d873de17c5..84a2be9ae020e78a03e5b6dc81083e851a122763 100644 (file)
@@ -1,5 +1,5 @@
 import textwrap
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
 
 
 class TestSeparators:
similarity index 96%
rename from Lib/test/json_tests/test_speedups.py
rename to Lib/test/test_json/test_speedups.py
index 5c24c0580b0ba23c18972b8194018a8a129b6a32..109a2466c21bdbd43528f22205a7f5f250377fac 100644 (file)
@@ -1,4 +1,4 @@
-from test.json_tests import CTest
+from test.test_json import CTest
 
 
 class TestSpeedups(CTest):
similarity index 98%
rename from Lib/test/json_tests/test_unicode.py
rename to Lib/test/test_json/test_unicode.py
index f226aa6f03dfd1583b01e4fb032b7d1cbcca4b60..c7cc8a7e92285cdfc1d426a125b96e2e49b5f1fc 100644 (file)
@@ -1,5 +1,5 @@
 from collections import OrderedDict
-from test.json_tests import PyTest, CTest
+from test.test_json import PyTest, CTest
 
 
 class TestUnicode:
index 73988b2ba2a7ca93e0ba016ac458f4dbb726cc49..dc895c0070c274ed7cd6aa4ad874a5afe3900ec6 100644 (file)
@@ -1036,7 +1036,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 \
index 35e1ae528953693b86aed42b992f750efc74054e..2550dc48450a7e99a3f08392445ee49e4f6ce494 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -237,6 +237,9 @@ IDLE
 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