relax async test requirement, expose more coverage

This commit is contained in:
Casper da Costa-Luis 2020-10-26 15:41:30 +00:00
parent dbd819bf0d
commit 1c547ec4ec
No known key found for this signature in database
GPG Key ID: 986B408043AE090D
3 changed files with 6 additions and 7 deletions

View File

@ -99,5 +99,5 @@ async def test_as_completed():
for i in as_completed([asyncio.sleep(0.01 * i)
for i in range(30, 0, -1)], file=our_file):
await i
assert 0.29 < time() - t - 2 * skew < 0.31
assert 0.28 < time() - t - 2 * skew < 0.32
assert '30/30' in our_file.getvalue()

View File

@ -48,8 +48,7 @@ def isBytes(val):
def posix_pipe(fin, fout, delim=b'\\n', buf_size=256,
callback=lambda float: None, # pragma: no cover
callback_len=True):
callback=lambda float: None, callback_len=True):
"""
Params
------
@ -68,7 +67,7 @@ def posix_pipe(fin, fout, delim=b'\\n', buf_size=256,
# flush at EOF
if not tmp:
getattr(fout, 'flush', lambda: None)() # pragma: no cover
getattr(fout, 'flush', lambda: None)()
return
fp_write(tmp)
@ -101,7 +100,7 @@ def posix_pipe(fin, fout, delim=b'\\n', buf_size=256,
else:
for i in buf.split(delim):
callback(i)
getattr(fout, 'flush', lambda: None)() # pragma: no cover
getattr(fout, 'flush', lambda: None)()
return # n
while True:

View File

@ -273,9 +273,9 @@ class CallbackIOWrapper(ObjectWrapper):
def _is_utf(encoding):
try:
u'\u2588\u2589'.encode(encoding)
except UnicodeEncodeError: # pragma: no cover
except UnicodeEncodeError:
return False
except Exception: # pragma: no cover
except Exception:
try:
return encoding.lower().startswith('utf-') or ('U8' == encoding)
except: