Skip to content

Commit 9099705

Browse files
committed
Workaround for tests in Python 3.4
related bug: http://bugs.python.org/issue21750
1 parent e8ba6a6 commit 9099705

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

jsonschema/tests/test_cli.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,16 @@ class TestParser(unittest.TestCase):
2222
FakeValidator = fake_validator()
2323

2424
def setUp(self):
25-
self.open = mock.mock_open(read_data='{}')
26-
patch = mock.patch.object(cli, "open", self.open, create=True)
27-
patch.start()
28-
self.addCleanup(patch.stop)
25+
mock_open = mock.mock_open()
26+
patch_open = mock.patch.object(cli, "open", mock_open, create=True)
27+
patch_open.start()
28+
self.addCleanup(patch_open.stop)
29+
30+
mock_json_load = mock.Mock()
31+
mock_json_load.return_value = {}
32+
patch_json_load = mock.patch("json.load")
33+
patch_json_load.start()
34+
self.addCleanup(patch_json_load.stop)
2935

3036
def test_find_validator_by_fully_qualified_object_name(self):
3137
arguments = cli.parse_args(

0 commit comments

Comments
 (0)