Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Changelog
=========

* :release:`0.12.3 <2023-12-20>`
* :support:`117` Improve the ``TestCase`` docstring example for notes about
unexpected external data changes
* :bug:`128` Properly handle assertion failures during setUp/tearDown
* :support:`145` Support Python 3.12 (and drop 3.8)
* :release:`0.12.2 <2023-12-20>`
Expand Down
17 changes: 17 additions & 0 deletions docs/examples/catalog_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import requests
import marbles.core


class CatalogTestCase(marbles.core.TestCase):

def test_product_count(self):
endpoint = 'https://example.com/api/v1/products'
products = requests.get(endpoint).json()

self.assertGreaterEqual(
len(products),
100,
note=('The upstream catalog normally contains at least 100 '
'products. A lower count may indicate an incomplete '
'data refresh.')
)
3 changes: 1 addition & 2 deletions marbles/core/marbles/core/marbles.py
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,7 @@ class TestCase(unittest.TestCase):

Example:

.. literalinclude:: examples/getting_started.py.annotated
:lines: 1-4,33-44
.. literalinclude:: examples/catalog_data.py
'''

failureException = ContextualAssertionError
Expand Down
Loading