Added option to stream from resources to reduce memory usage

This commit is contained in:
kvanzuijlen 2020-07-12 11:54:46 +02:00 committed by Koen van Zuijlen
parent 705052ae66
commit 92004058ba
8 changed files with 174 additions and 192 deletions

View file

@ -6,10 +6,11 @@ import os
import sys
import time
import pylast
import pytest
from flaky import flaky
import pylast
WRITE_TEST = sys.version_info[:2] == (3, 8)
@ -82,9 +83,9 @@ class TestPyLastWithLastFm(PyLastTestCase):
assert a is not None
assert b is not None
assert c is not None
assert len(a) >= 0
assert len(b) >= 0
assert len(c) >= 0
assert isinstance(len(a), int)
assert isinstance(len(b), int)
assert isinstance(len(c), int)
assert a == b
assert b == c
@ -94,9 +95,9 @@ class TestPyLastWithLastFm(PyLastTestCase):
func = getattr(thing, function_name, None)
# Act
result1 = func(limit=1, cacheable=False)
result2 = func(limit=1, cacheable=True)
result3 = func(limit=1)
result1 = func(limit=1, cacheable=False, stream=False)
result2 = func(limit=1, cacheable=True, stream=False)
result3 = list(func(limit=1))
# Assert
self.helper_validate_results(result1, result2, result3)