diff --git a/fauna/client/client.py b/fauna/client/client.py index 6b03ad6d..1ff793ae 100644 --- a/fauna/client/client.py +++ b/fauna/client/client.py @@ -446,7 +446,6 @@ def stream( if opts.cursor is not None: raise ClientError( "The 'cursor' configuration can only be used with a stream token.") - token = self.query(fql).data else: token = fql diff --git a/tests/integration/test_stream.py b/tests/integration/test_stream.py index 9d312fed..12562060 100644 --- a/tests/integration/test_stream.py +++ b/tests/integration/test_stream.py @@ -1,12 +1,11 @@ import threading -import time import httpx import pytest from fauna import fql from fauna.client import Client, StreamOptions -from fauna.errors import ClientError, NetworkError, RetryableFaunaException, QueryRuntimeError +from fauna.errors import ClientError, RetryableFaunaException, QueryRuntimeError, NetworkError from fauna.http.httpx_client import HTTPXClient @@ -107,11 +106,16 @@ def test_max_retries(scoped_secret): count = [0] - def stream_func(*args, **kwargs): + old_send = httpx_client.send + + def send_func(*args, **kwargs): + if not kwargs['stream']: + return old_send(*args, **kwargs) + count[0] += 1 raise NetworkError('foo') - httpx_client.stream = stream_func + httpx_client.send = send_func count[0] = 0 with pytest.raises(RetryableFaunaException):