File tree 2 files changed +7
-11
lines changed 2 files changed +7
-11
lines changed Original file line number Diff line number Diff line change 1
1
from unittest import TestCase
2
-
3
- try :
4
- from unittest import mock
5
- except ImportError :
6
- from mock import mock
7
-
8
2
import json
9
3
import subprocess
10
4
import sys
11
5
6
+ try :
7
+ from StringIO import StringIO
8
+ except ImportError :
9
+ from io import StringIO
10
+
12
11
from jsonschema import Draft4Validator , ValidationError , cli , __version__
13
12
from jsonschema .compat import NativeIO
14
13
from jsonschema .exceptions import SchemaError
@@ -156,9 +155,8 @@ def test_version(self):
156
155
version = version .decode ("utf-8" ).strip ()
157
156
self .assertEqual (version , __version__ )
158
157
159
- @mock .patch ("sys.stdin" )
160
- def test_piping (self , mock_stdin ):
161
- mock_stdin .read .return_value = "{}"
158
+ def test_piping (self ):
159
+ sys .stdin = StringIO ("{}" )
162
160
stdout , stderr = NativeIO (), NativeIO ()
163
161
exit_code = cli .run (
164
162
{
@@ -170,7 +168,6 @@ def test_piping(self, mock_stdin):
170
168
stdout = stdout ,
171
169
stderr = stderr ,
172
170
)
173
- mock_stdin .read .assert_called_once_with ()
174
171
self .assertFalse (stdout .getvalue ())
175
172
self .assertFalse (stderr .getvalue ())
176
173
self .assertEqual (exit_code , 0 )
Original file line number Diff line number Diff line change 55
55
perf: pyperf
56
56
57
57
tests,tests_nongpl,coverage,codecov: -r{toxinidir}/test-requirements.txt
58
- pypy: mock
59
58
60
59
coverage,codecov: coverage
61
60
codecov: codecov
You can’t perform that action at this time.
0 commit comments