I am trying to write tests for an aiohttp application. I am using the pytest-aiohttp plugin. My intention is to initialize and run the application once before the first test run and disrupt it after all tests are complete. The pytest-aiohttp fixtures, such as "loop", "test_client", are very useful, but they have scope = 'function', which means that I cannot use them from my own tool with scope = 'session'. Is there any way around this? And if not, what would be the appropriate approach to achieve my goal without using built-in lights? My code is as follows (conftest.py)
@pytest.fixture()
def client(test_client, loop):
app = init(loop)
return loop.run_until_complete(test_client(app))
Then my tests use
class TestGetAlerts:
async def test_get_login_url(self, client):
resp = await client.get('/api/get_login_url')
assert resp.status == 200
, "" , .