From 393ff70701813fbaaf456b5a44eb8e6a4d24a5be Mon Sep 17 00:00:00 2001 From: Florian Zimmermann Date: Tue, 16 Jul 2024 19:53:39 +0200 Subject: [PATCH] remove the section about snapshot testing from the testing docs because the snapshottest package doesn't work on Python 3.12 and above --- docs/testing/index.rst | 40 ---------------------------------------- 1 file changed, 40 deletions(-) diff --git a/docs/testing/index.rst b/docs/testing/index.rst index 877879f6..db858b17 100644 --- a/docs/testing/index.rst +++ b/docs/testing/index.rst @@ -69,43 +69,3 @@ You can also add extra keyword arguments to the ``execute`` method, such as 'hey': 'hello Peter!' } } - - -Snapshot testing -~~~~~~~~~~~~~~~~ - -As our APIs evolve, we need to know when our changes introduce any breaking changes that might break -some of the clients of our GraphQL app. - -However, writing tests and replicating the same response we expect from our GraphQL application can be a -tedious and repetitive task, and sometimes it's easier to skip this process. - -Because of that, we recommend the usage of `SnapshotTest `_. - -SnapshotTest lets us write all these tests in a breeze, as it automatically creates the ``snapshots`` for us -the first time the test are executed. - - -Here is a simple example on how our tests will look if we use ``pytest``: - -.. code:: python - - def test_hey(snapshot): - client = Client(my_schema) - # This will create a snapshot dir and a snapshot file - # the first time the test is executed, with the response - # of the execution. - snapshot.assert_match(client.execute('''{ hey }''')) - - -If we are using ``unittest``: - -.. code:: python - - from snapshottest import TestCase - - class APITestCase(TestCase): - def test_api_me(self): - """Testing the API for /me""" - client = Client(my_schema) - self.assertMatchSnapshot(client.execute('''{ hey }'''))