@@ -419,7 +419,7 @@ unhandled and in the end the test will be failed.
419419
420420In some cases, however, you want to make sure that everything is ok so far,
421421and raise AssertionError when something is not good. Call the
422- ``check_assertions () `` method of the httpserver object, and this will look at
422+ ``check () `` method of the httpserver object, and this will look at
423423the server's internal state (which is running in the other thread) and if
424424there's something not right (such as the order of the requests not matching,
425425or there was a non-matching request), it will raise an AssertionError and
@@ -434,7 +434,7 @@ your test will properly fail:
434434 requests.get(httpserver.url_for(" /foobaz" ))
435435 requests.get(httpserver.url_for(" /foobar" )) # gets 500
436436
437- httpserver.check_assertions () # this will raise AssertionError and make the test failing
437+ httpserver.check () # this will raise AssertionError and make the test failing
438438
439439 This will also produce a (hopefully) helpful description about what went wrong::
440440
@@ -450,10 +450,10 @@ This will also produce a (hopefully) helpful description about what went wrong::
450450 E none
451451
452452
453- Calling ``check_assertions () `` for all tests
453+ Calling ``check () `` for all tests
454454~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
455455
456- Sometimes you want to see the informative message made by ``check_assertions () `` if
456+ Sometimes you want to see the informative message made by ``check () `` if
457457your test failed.
458458
459459In such case you can implement a new fixture or override the behavior:
@@ -471,7 +471,7 @@ In such case you can implement a new fixture or override the behavior:
471471 @pytest.fixture
472472 def httpserver (httpserver : HTTPServer) -> Iterable[HTTPServer]:
473473 yield httpserver
474- httpserver.check_assertions () # this will raise AssertionError and make the test failing
474+ httpserver.check () # this will raise AssertionError and make the test failing
475475
476476
477477 def test_client (httpserver : HTTPServer):
@@ -520,7 +520,7 @@ Debugging
520520~~~~~~~~~
521521
522522If you having multiple requests for the server, adding the call to
523- ``check_assertions () `` may to debug as it will make the test failed as
523+ ``check () `` may help to debug as it will make the test failed as
524524soon as possible.
525525
526526.. code :: python
@@ -534,20 +534,20 @@ soon as possible.
534534 requests.get(httpserver.url_for(" /bar" ))
535535 requests.get(httpserver.url_for(" /foobar" ))
536536
537- httpserver.check_assertions ()
537+ httpserver.check ()
538538
539539 In the above code, the first request (to **/foo **) is not successful (it gets
540540http status 500), but as the response status is not checked (or any of the
541- response), and there's no call to ``check_assertions () ``, the test continues the
541+ response), and there's no call to ``check () ``, the test continues the
542542running. It gets through the **/bar ** request, which is also not successful
543543(and gets http status 500 also like the first one), then goes the last request
544544which is successful (as there's a handler defined for it)
545545
546- In the end, when checking the check_assertions () raise the error for the first
546+ In the end, when checking the check () raise the error for the first
547547request, but it is a bit late: figuring out the request which caused the problem
548548could be troublesome. Also, it will report the problem for the first request only.
549549
550- Adding more call of ``check_assertions () `` will help.
550+ Adding more call of ``check () `` will help.
551551
552552
553553.. code :: python
@@ -558,13 +558,13 @@ Adding more call of ``check_assertions()`` will help.
558558 def test_json_client (httpserver : HTTPServer):
559559 httpserver.expect_request(" /foobar" ).respond_with_json({" foo" : " bar" })
560560 requests.get(httpserver.url_for(" /foo" ))
561- httpserver.check_assertions ()
561+ httpserver.check ()
562562
563563 requests.get(httpserver.url_for(" /bar" ))
564- httpserver.check_assertions ()
564+ httpserver.check ()
565565
566566 requests.get(httpserver.url_for(" /foobar" ))
567- httpserver.check_assertions ()
567+ httpserver.check ()
568568
569569
570570 In the above code, the test will fail after the first request.
0 commit comments