-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
type: questiongeneral question, might be closed after 2 weeks of inactivitygeneral question, might be closed after 2 weeks of inactivity
Description
I'm using pytest to run "black-box" testing against a running web application, using requests
for http.
When the http call fails (for any reason), this causes the pytest test to fail, with a very verbose output that actually contains the code from some requests
class:
stack = <utils.local_stack.LocalStack object at 0x7f6a17694518>
@pytest.fixture(scope="function")
def prepare(stack):
> response = api.do_some_http_call()
tests/conftest.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
apis/redacted.py:36: in do_some_http_call
return requests.get(.... some url ... )
../../../../.local/lib/python3.6/site-packages/requests/api.py:72: in get
return request('get', url, params=params, **kwargs)
../../../../.local/lib/python3.6/site-packages/requests/api.py:58: in request
return session.request(method=method, url=url, **kwargs)
../../../../.local/lib/python3.6/site-packages/requests/sessions.py:508: in request
resp = self.send(prep, **send_kwargs)
../../../../.local/lib/python3.6/site-packages/requests/sessions.py:618: in send
r = adapter.send(request, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <requests.adapters.HTTPAdapter object at 0x7f6a1740ae80>, request = <PreparedRequest [GET]>, stream = False, timeout = <urllib3.util.timeout.Timeout object at 0x7f6a1740ac50>, verify = True, cert = None, proxies = OrderedDict()
def send(self, request, stream=False, timeout=None, verify=True, cert=None, proxies=None):
"""Sends PreparedRequest object. Returns Response object.
:param request: The :class:`PreparedRequest <PreparedRequest>` being sent.
:param stream: (optional) Whether to stream the request content.
:param timeout: (optional) How long to wait for the server to send
data before giving up, as a float, or a :ref:`(connect timeout,
read timeout) <timeouts>` tuple.
:type timeout: float or tuple or urllib3 Timeout object
:param verify: (optional) Either a boolean, in which case it controls whether
we verify the server's TLS certificate, or a string, in which case it
must be a path to a CA bundle to use
:param cert: (optional) Any user-provided SSL certificate to be trusted.
:param proxies: (optional) The proxies dictionary to apply to the request.
:rtype: requests.Response
"""
... etc ...
Is it the expected behavior of pytest ? Could it be because the Exception is raised in a fixture from conftest.py ? How can I make the output more readable (I really only want the stacktrace, not the full code...)
Metadata
Metadata
Assignees
Labels
type: questiongeneral question, might be closed after 2 weeks of inactivitygeneral question, might be closed after 2 weeks of inactivity