Captures written in the captures directory on the controller

This commit is contained in:
Julien Duponchelle committed 2016-04-26 17:10:33 +02:00
1 parent 9a1eeb57e9
commit 264254e657
9 files changed
+155 -40

No files matched your search

+20
View File
@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import io
import asyncio
import unittest.mock
@@ -87,3 +88,22 @@ class AsyncioMagicMock(unittest.mock.MagicMock):
Original code: https://github.com/python/cpython/blob/121f86338111e49c547a55eb7f26db919bfcbde9/Lib/unittest/mock.py
"""
return AsyncioMagicMock(**kw)
class AsyncioBytesIO(io.BytesIO):
"""
An async wrapper arround io.BytesIO to fake an
async network connection
"""
@asyncio.coroutine
def read(self, length=-1):
return super().read(length)
@asyncio.coroutine
def write(self, data):
return super().write(data)
@asyncio.coroutine
def close(self):
return super().close()