mirror of https://github.com/python/cpython
#18273: move the tests in Lib/test/json_tests to Lib/test/test_json and make them discoverable by unittest. Patch by Zachary Ware.
This commit is contained in:
parent
0d2d2b8393
commit
66f2ea042a
|
@ -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()
|
|
@ -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()
|
|
@ -0,0 +1,4 @@
|
|||
import unittest
|
||||
from test.test_json import load_tests
|
||||
|
||||
unittest.main()
|
|
@ -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:
|
|
@ -1,4 +1,4 @@
|
|||
from test.json_tests import PyTest, CTest
|
||||
from test.test_json import PyTest, CTest
|
||||
|
||||
|
||||
class TestDefault:
|
|
@ -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
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
from collections import OrderedDict
|
||||
from test.json_tests import PyTest, CTest
|
||||
from test.test_json import PyTest, CTest
|
||||
|
||||
|
||||
CASES = [
|
|
@ -1,4 +1,4 @@
|
|||
from test.json_tests import PyTest, CTest
|
||||
from test.test_json import PyTest, CTest
|
||||
|
||||
# 2007-10-05
|
||||
JSONDOCS = [
|
|
@ -1,5 +1,5 @@
|
|||
import math
|
||||
from test.json_tests import PyTest, CTest
|
||||
from test.test_json import PyTest, CTest
|
||||
|
||||
|
||||
class TestFloat:
|
|
@ -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:
|
|
@ -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
|
|
@ -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
|
|
@ -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
|
|
@ -1,4 +1,4 @@
|
|||
from test.json_tests import PyTest, CTest
|
||||
from test.test_json import PyTest, CTest
|
||||
|
||||
|
||||
class JSONTestObject:
|
|
@ -1,5 +1,5 @@
|
|||
import sys
|
||||
from test.json_tests import PyTest, CTest
|
||||
from test.test_json import PyTest, CTest
|
||||
|
||||
|
||||
class TestScanstring:
|
|
@ -1,5 +1,5 @@
|
|||
import textwrap
|
||||
from test.json_tests import PyTest, CTest
|
||||
from test.test_json import PyTest, CTest
|
||||
|
||||
|
||||
class TestSeparators:
|
|
@ -1,4 +1,4 @@
|
|||
from test.json_tests import CTest
|
||||
from test.test_json import CTest
|
||||
|
||||
|
||||
class TestSpeedups(CTest):
|
|
@ -1,5 +1,5 @@
|
|||
from collections import OrderedDict
|
||||
from test.json_tests import PyTest, CTest
|
||||
from test.test_json import PyTest, CTest
|
||||
|
||||
|
||||
class TestUnicode:
|
|
@ -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 \
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue