Closed simonw closed 4 years ago
Testing on my laptop:
% /Users/simon/.pyenv/versions/3.6.10/bin/python -m venv /tmp/python36env
% source /tmp/python36env/bin/activate
% cd Dropbox/Development/datasette-graphql
datasette-graphql % pip install -e '.[test]'
...
% pytest
...
> assert mock_schema_for_database.called
E AssertionError: assert False
E + where False = <MagicMock name='schema_for_database' id='4517736632'>.called
tests/test_schema_caching.py:34: AssertionError
==== short test summary info ====
FAILED tests/test_schema_caching.py::test_schema_caching - AssertionError: assert False
==== 1 failed, 47 passed in 2.44s ====
I wonder if this is the problem: https://docs.python.org/3/library/unittest.mock.html#patch
Changed in version 3.8:
patch()
now returns an AsyncMock if the target is an async function.
I'm going to only run the template tag test on Python 3.8 or higher, rather than figure out how to get async mocking working on older Pythons.
Broken due to #51 commit https://github.com/simonw/datasette-graphql/commit/ae717857cde97db4a52054310b029bf8ba222d7c
Tests pass in 3.8, fail in 3.6 and 3.7.