Closed
Description
Hi I'm trying the django example from: https://devblogs.microsoft.com/python/announcing-playwright-for-python-reliable-end-to-end-testing-for-the-web/
But I'm getting this error:
Creating test database for alias 'default'...
System check identified no issues (1 silenced).
.E
======================================================================
ERROR: test_login (app.tests_playwright.MyViewTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\test\testcases.py", line 274, in __call__
self._post_teardown()
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\test\testcases.py", line 1009, in _post_teardown
self._fixture_teardown()
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\test\testcases.py", line 1044, in _fixture_teardown
inhibit_post_migrate=inhibit_post_migrate)
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\core\management\__init__.py", line 168, in call_command
return command.execute(*args, **defaults)
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\core\management\base.py", line 369, in execute
output = self.handle(*args, **options)
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\core\management\commands\flush.py", line 49, in handle
allow_cascade=allow_cascade)
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\core\management\sql.py", line 13, in sql_flush
tables = connection.introspection.django_table_names(only_existing=True, include_views=False)
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\db\backends\base\introspection.py", line 85, in django_table_names
existing_tables = set(self.table_names(include_views=include_views))
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\db\backends\base\introspection.py", line 46, in table_names
with self.connection.cursor() as cursor:
File "C:\Users\Lubitz\.virtualenvs\DjangoBasisLager-JHlOkGlw\lib\site-packages\django\utils\asyncio.py", line 24, in inner
raise SynchronousOnlyOperation(message)
django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.
----------------------------------------------------------------------
Ran 1 test in 2.323s
FAILED (errors=1)
Destroying test database for alias 'default'...
```