Skip to content

Commit 61ab3c0

Browse files
committed
WIP - 100% coverage
1 parent 1b31b09 commit 61ab3c0

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,9 @@ jobs:
9797
export WITH='--with mysqlclient'
9898
# 127.0.0.1 is to persuade mysqlclient to use tcp rather than the domain socket :-/
9999
export DB_URL=mysql://root:mysql@127.0.0.1:3306/test_db
100-
else
101-
export DB_URL=sqlite:///foo.sqlite
102100
fi
103101
export COVERAGE_FILE=.coverage.$GITHUB_JOB
104102
uv run -v --all-extras --dev $WITH --resolution ${{ matrix.uv-resolution }} -m coverage run -m pytest --sqlalchemy-connect-url=$DB_URL
105-
coverage report
106103
107104
- name: Upload coverage data
108105
uses: actions/upload-artifact@v4

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ build-backend = "setuptools.build_meta"
3333

3434
[tool.coverage.run]
3535
source = ["pytest_sqlalchemy", "tests"]
36+
parallel = true
3637

3738
[tool.pytest.ini_options]
3839
norecursedirs = ["tests/examples"]

tests/test_plugin.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,16 @@ def test_engine_no_config_source(pytester: Pytester) -> None:
8989

9090

9191
def test_xdist_naming(pytester: Pytester, db_url: str) -> None:
92+
pyproject_toml = Path(__file__).parent.parent / "pyproject.toml"
93+
pytester.makeconftest(dedent(f"""
94+
import coverage, os
95+
96+
def pytest_configure(config):
97+
worker_id = os.environ.get("PYTEST_XDIST_WORKER")
98+
if worker_id is not None:
99+
os.environ["COVERAGE_PROCESS_START"] = "{pyproject_toml}"
100+
coverage.process_startup()
101+
"""))
92102
pytester.copy_example("tests/examples/test_xdist.py")
93103
result = pytester.runpytest('-n', '2', '--sqlalchemy-connect-url', db_url)
94104
result.assert_outcomes(passed=2)

0 commit comments

Comments
 (0)