Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 48678af

Browse files
authoredAug 8, 2024··
fix: run the tests in python 3.12 and 3.13 and remove snapshottest dependency (#1572)
* actually run the tests in python 3.12 and 3.13 * remove snapshottest from the example tests so that the tests pass in 3.12 and 3.13 again * remove the section about snapshot testing from the testing docs because the snapshottest package doesn't work on Python 3.12 and above * fix assertion for badly formed JSON input on Python 3.13 * fix deprecation warning about datetime.utcfromtimestamp()
1 parent dc3b2e4 commit 48678af

File tree

15 files changed

+344
-445
lines changed

15 files changed

+344
-445
lines changed
 

‎docs/testing/index.rst

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -69,43 +69,3 @@ You can also add extra keyword arguments to the ``execute`` method, such as
6969
'hey': 'hello Peter!'
7070
}
7171
}
72-
73-
74-
Snapshot testing
75-
~~~~~~~~~~~~~~~~
76-
77-
As our APIs evolve, we need to know when our changes introduce any breaking changes that might break
78-
some of the clients of our GraphQL app.
79-
80-
However, writing tests and replicating the same response we expect from our GraphQL application can be a
81-
tedious and repetitive task, and sometimes it's easier to skip this process.
82-
83-
Because of that, we recommend the usage of `SnapshotTest <https://github.com/syrusakbary/snapshottest/>`_.
84-
85-
SnapshotTest lets us write all these tests in a breeze, as it automatically creates the ``snapshots`` for us
86-
the first time the test are executed.
87-
88-
89-
Here is a simple example on how our tests will look if we use ``pytest``:
90-
91-
.. code:: python
92-
93-
def test_hey(snapshot):
94-
client = Client(my_schema)
95-
# This will create a snapshot dir and a snapshot file
96-
# the first time the test is executed, with the response
97-
# of the execution.
98-
snapshot.assert_match(client.execute('''{ hey }'''))
99-
100-
101-
If we are using ``unittest``:
102-
103-
.. code:: python
104-
105-
from snapshottest import TestCase
106-
107-
class APITestCase(TestCase):
108-
def test_api_me(self):
109-
"""Testing the API for /me"""
110-
client = Client(my_schema)
111-
self.assertMatchSnapshot(client.execute('''{ hey }'''))

‎examples/starwars/tests/snapshots/__init__.py

Whitespace-only changes.

‎examples/starwars/tests/snapshots/snap_test_query.py

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.