Skip to content

Commit

Permalink
Merge branch 'master' into pre-commit-ci-update-config
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm authored Jan 15, 2024
2 parents b6e1cbd + e417e34 commit 8faccc5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
from __future__ import annotations

import os
from asyncio import AbstractEventLoop, new_event_loop, set_event_loop
from collections.abc import AsyncGenerator, Generator
from typing import Any, cast

import pytest
import pytest_asyncio
from _pytest.fixtures import SubRequest
from pytest import TempPathFactory
from pytest_asyncio import is_async_test
from pytest_lazyfixture import lazy_fixture
from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine
from sqlalchemy.future import Engine, create_engine

from asphalt.sqlalchemy.utils import apply_sqlite_hacks


@pytest.fixture(scope="session")
def event_loop() -> Generator[AbstractEventLoop, Any, None]:
# Required for session scoped async fixtures
loop = new_event_loop()
set_event_loop(loop)
yield loop
loop.close()
def pytest_collection_modifyitems(items):
pytest_asyncio_tests = (item for item in items if is_async_test(item))
session_scope_marker = pytest.mark.asyncio(scope="session")
for async_test in pytest_asyncio_tests:
async_test.add_marker(session_scope_marker)


@pytest.fixture(scope="session")
Expand Down

0 comments on commit 8faccc5

Please sign in to comment.