Fix failing test

This commit is contained in:
Miroslav Kovar 2019-10-16 22:52:05 +02:00 committed by Lex Berezhny
parent 2737b3635f
commit 5501418727

View file

@ -197,20 +197,11 @@ class CommandTestCase(IntegrationTestCase):
""" Synchronous version of `out` method. """ """ Synchronous version of `out` method. """
return json.loads(jsonrpc_dumps_pretty(value, ledger=self.ledger))['result'] return json.loads(jsonrpc_dumps_pretty(value, ledger=self.ledger))['result']
def create_tempfile(self, data=None, prefix=None, suffix=None, dir_path=None): def create_tempfile(self, data=None, prefix=None, suffix=None):
dir_path = dir_path or self.daemon.conf.download_dir self._file = tempfile.NamedTemporaryFile(prefix=prefix, suffix=suffix)
file = tempfile.NamedTemporaryFile(prefix=prefix, suffix=suffix, dir=dir_path) self._file.write(data)
file.write(data) self._file.flush()
file.flush() return self._file.name
def cleanup():
try:
file.close()
except FileNotFoundError:
pass
self.addCleanup(cleanup)
return file.name
async def stream_create(self, name='hovercraft', bid='1.0', data=b'hi!', confirm=True, async def stream_create(self, name='hovercraft', bid='1.0', data=b'hi!', confirm=True,
prefix=None, suffix=None, **kwargs): prefix=None, suffix=None, **kwargs):