This repository was archived by the owner on May 27, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 10 files changed +31
-19
lines changed
Filter options
Expand file tree Collapse file tree 10 files changed +31
-19
lines changed
Original file line number Diff line number Diff line change
1
+ 20190405
2
+ ========
3
+
4
+ - Release 1.9.2
5
+ - async() matcher is available as async_mode() for python3.7 and newer
6
+
7
+
1
8
20141126
2
9
========
3
10
Original file line number Diff line number Diff line change
1
+ doublex (1.9.2-1) unstable; urgency=low
2
+
3
+ * New release
4
+
5
+ -- David Villa Alises <David.Villa@gmail.com> Fri, 05 Apr 2019 11:24:14 +0200
6
+
1
7
doublex (1.9.1-2) unstable; urgency=low
2
8
3
9
* New release
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ for Spy methods
86
86
87
87
See :ref: `called `.
88
88
89
- .. py :method :: called.async (timeout)
89
+ .. py :method :: called.async_mode (timeout)
90
90
91
91
The ``called `` assertion waits the corresponding invocation a maximum of `timeout `
92
92
seconds.
@@ -95,9 +95,9 @@ for Spy methods
95
95
96
96
::
97
97
98
- assert_that(spy.method, called().async (1))
98
+ assert_that(spy.method, called().async_mode (1))
99
99
100
- See :ref: `async `.
100
+ See :ref: `async_mode `.
101
101
102
102
103
103
.. py :method :: called.times(value)
Original file line number Diff line number Diff line change 1
- .. _ async :
1
+ .. async_mode :
2
2
3
3
Asynchronous spies
4
4
==================
@@ -86,7 +86,7 @@ barrier. If the ``write()`` invocation never happens, the ``barrier.wait()`` con
86
86
after 1 second but the test fails, as must do. When all is right, the barrier waits just
87
87
the required time.
88
88
89
- Well, this mechanism is a doublex builtin (the ``async `` matcher) since release 1.5.1
89
+ Well, this mechanism is a doublex builtin (the ``async_mode `` matcher) since release 1.5.1
90
90
providing the same behavior in a clearer way. The next is functionally equivalent to the
91
91
listing just above:
92
92
@@ -104,7 +104,7 @@ listing just above:
104
104
sut.some_method()
105
105
106
106
# then
107
- assert_that(spy.write, called().async (timeout=1))
107
+ assert_that(spy.write, called().async_mode (timeout=1))
108
108
109
109
110
110
.. Local Variables:
Original file line number Diff line number Diff line change 1
- .. _async :
1
+ .. async_mode :
2
2
3
3
Asynchronous spies
4
4
==================
@@ -86,7 +86,7 @@ barrier. If the ``write()`` invocation never happens, the ``barrier.wait()`` con
86
86
after 1 second but the test fails, as must do. When all is right, the barrier waits just
87
87
the required time.
88
88
89
- Well, this mechanism is a doublex builtin (the ``async `` matcher) since release 1.5.1
89
+ Well, this mechanism is a doublex builtin (the ``async_mode `` matcher) since release 1.5.1
90
90
providing the same behavior in a clearer way. The next is functionally equivalent to the
91
91
listing just above:
92
92
@@ -104,7 +104,7 @@ listing just above:
104
104
sut.some_method()
105
105
106
106
# then
107
- assert_that(spy.write, called().async (timeout=1))
107
+ assert_that(spy.write, called().async_mode (timeout=1))
108
108
109
109
110
110
.. Local Variables:
Original file line number Diff line number Diff line change @@ -201,14 +201,12 @@ def delegates(self, delegate):
201
201
def returns (self , value ):
202
202
self .context .retval = value
203
203
self .delegates (func_returning (value ))
204
- return self
205
204
206
205
def returns_input (self ):
207
206
if not self .context .args :
208
207
raise TypeError ("%s has no input args" % self )
209
208
210
209
self .delegates (func_returning_input (self ))
211
- return self
212
210
213
211
def raises (self , e ):
214
212
self .delegates (func_raising (e ))
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ def _matches(self, method):
98
98
99
99
if self ._async_timeout :
100
100
if self ._times != any_time :
101
- raise WrongApiUsage ("'times' and 'async ' are exclusive" )
101
+ raise WrongApiUsage ("'times' and 'async_mode ' are exclusive" )
102
102
self .method ._event .wait (self ._async_timeout )
103
103
104
104
return method ._was_called (self .context , self ._times )
@@ -127,7 +127,7 @@ def with_some_args(self, **kargs):
127
127
self .context .check_some_args = True
128
128
return self
129
129
130
- def _async (self , timeout ):
130
+ def async_mode (self , timeout ):
131
131
self ._async_timeout = timeout
132
132
return self
133
133
@@ -136,8 +136,9 @@ def times(self, n):
136
136
return self
137
137
138
138
139
+ # backward compatibility
139
140
if sys .version_info < (3 , 7 ):
140
- setattr (MethodCalled , 'async' , MethodCalled ._async )
141
+ setattr (MethodCalled , 'async' , MethodCalled .async_mode )
141
142
142
143
143
144
def called ():
Original file line number Diff line number Diff line change @@ -41,4 +41,4 @@ def test_wrong_try_to_test_an_async_invocation(self):
41
41
sut .some_method ()
42
42
43
43
# then
44
- assert_that (spy .write , called ()._async (1 ))
44
+ assert_that (spy .write , called ().async_mode (1 ))
Original file line number Diff line number Diff line change @@ -1345,7 +1345,7 @@ def test_spy_call_with_async_feature(self):
1345
1345
sut .send_data ()
1346
1346
1347
1347
# then
1348
- assert_that (spy .write , called ()._async (timeout = 1 ))
1348
+ assert_that (spy .write , called ().async_mode (timeout = 1 ))
1349
1349
1350
1350
def test_spy_async_support_1_call_only (self ):
1351
1351
# given
@@ -1358,7 +1358,7 @@ def test_spy_async_support_1_call_only(self):
1358
1358
1359
1359
# then
1360
1360
with self .assertRaises (WrongApiUsage ):
1361
- assert_that (spy .write , called ()._async (timeout = 1 ).with_args (3 ).times (2 ))
1361
+ assert_that (spy .write , called ().async_mode (timeout = 1 ).with_args (3 ).times (2 ))
1362
1362
1363
1363
def test_spy_async_stubbed (self ):
1364
1364
# given
@@ -1371,7 +1371,7 @@ def test_spy_async_stubbed(self):
1371
1371
sut .send_data (3 )
1372
1372
1373
1373
# then
1374
- assert_that (spy .write , called ()._async (timeout = 1 ))
1374
+ assert_that (spy .write , called ().async_mode (timeout = 1 ))
1375
1375
1376
1376
1377
1377
# new on 1.7
Original file line number Diff line number Diff line change 1
- __version__ = '1.9.1 '
1
+ __version__ = '1.9.2 '
You can’t perform that action at this time.
0 commit comments