Skip to content

Commit 97cf8d6

Browse files
Merge pull request #192 from DiamondLightSource/fix_pytest-cov_ci_fails
Add required configuration for pytest-codecov 7
2 parents 54435ca + 1eb91e3 commit 97cf8d6

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,4 @@ asyncio_mode = auto
8282
[coverage:run]
8383
# This is covered in the versiongit test suite so exclude it here
8484
omit = */_version_git.py
85+
patch = subprocess

tests/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def enable_code_coverage():
134134
try:
135135
from pytest_cov.embed import cleanup_on_sigterm
136136
except ImportError:
137-
pass
137+
pass # Note that pytest_cov.embed no longer exists in pytest_cov>=7.0.0
138138
else:
139139
cleanup_on_sigterm()
140140

tests/sim_asyncio_ioc.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,12 @@ async def on_update_name_callback(value, name):
5454
conn.send("R") # "Ready"
5555

5656
# Make sure coverage is written on epicsExit
57-
from pytest_cov.embed import cleanup
58-
sys._run_exitfuncs = cleanup
57+
try:
58+
from pytest_cov.embed import cleanup
59+
sys._run_exitfuncs = cleanup
60+
except ImportError:
61+
# Note that pytest_cov.embed no longer exists in pytest_cov>=7.0.0
62+
pass
5963

6064
select_and_recv(conn, "D") # "Done"
6165
# Attempt to ensure all buffers flushed - C code (from `import pvlog`)

tests/sim_asyncio_ioc_override.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@
4646
conn.send("R") # "Ready"
4747

4848
# Make sure coverage is written on epicsExit
49-
from pytest_cov.embed import cleanup
50-
sys._run_exitfuncs = cleanup
49+
try:
50+
from pytest_cov.embed import cleanup
51+
sys._run_exitfuncs = cleanup
52+
except ImportError:
53+
# Note that pytest_cov.embed no longer exists in pytest_cov>=7.0.0
54+
pass
5155

5256
select_and_recv(conn, "D") # "Done"
5357
# Attempt to ensure all buffers flushed - C code (from `import pvlog`)

0 commit comments

Comments
 (0)