From 5501418727ea19cc42e022f451f1bad2187d3578 Mon Sep 17 00:00:00 2001 From: Miroslav Kovar Date: Wed, 16 Oct 2019 22:52:05 +0200 Subject: [PATCH] Fix failing test --- lbry/lbry/testcase.py | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/lbry/lbry/testcase.py b/lbry/lbry/testcase.py index 6f92f90af..274fe3a32 100644 --- a/lbry/lbry/testcase.py +++ b/lbry/lbry/testcase.py @@ -197,20 +197,11 @@ class CommandTestCase(IntegrationTestCase): """ Synchronous version of `out` method. """ return json.loads(jsonrpc_dumps_pretty(value, ledger=self.ledger))['result'] - def create_tempfile(self, data=None, prefix=None, suffix=None, dir_path=None): - dir_path = dir_path or self.daemon.conf.download_dir - file = tempfile.NamedTemporaryFile(prefix=prefix, suffix=suffix, dir=dir_path) - file.write(data) - file.flush() - - def cleanup(): - try: - file.close() - except FileNotFoundError: - pass - - self.addCleanup(cleanup) - return file.name + def create_tempfile(self, data=None, prefix=None, suffix=None): + self._file = tempfile.NamedTemporaryFile(prefix=prefix, suffix=suffix) + self._file.write(data) + self._file.flush() + return self._file.name async def stream_create(self, name='hovercraft', bid='1.0', data=b'hi!', confirm=True, prefix=None, suffix=None, **kwargs):