Skip to content

Commit c299e01

Browse files
committed
Add explicit suffixing to make it easier to see the identify the sources/usages of the data files.
1 parent c87e546 commit c299e01

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

src/pytest_cov/engine.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import coverage
1414
from coverage.data import CoverageData
15+
from coverage.sqldata import filename_suffix
1516

1617
from .embed import cleanup
1718

@@ -51,6 +52,10 @@ def ensure_topdir_wrapper(self, *args, **kwargs):
5152
return ensure_topdir_wrapper
5253

5354

55+
def _data_suffix(name):
56+
return f'{filename_suffix(True)}.{name}'
57+
58+
5459
class CovController:
5560
"""Base class for different plugin implementations."""
5661

@@ -230,13 +235,13 @@ def start(self):
230235
self.cov = coverage.Coverage(
231236
source=self.cov_source,
232237
branch=self.cov_branch,
233-
data_suffix=True,
238+
data_suffix=_data_suffix('c'),
234239
config_file=self.cov_config,
235240
)
236241
self.combining_cov = coverage.Coverage(
237242
source=self.cov_source,
238243
branch=self.cov_branch,
239-
data_suffix=True,
244+
data_suffix=_data_suffix('cc'),
240245
data_file=os.path.abspath(self.cov.config.data_file), # noqa: PTH100
241246
config_file=self.cov_config,
242247
)
@@ -274,7 +279,7 @@ def start(self):
274279
self.cov = coverage.Coverage(
275280
source=self.cov_source,
276281
branch=self.cov_branch,
277-
data_suffix=True,
282+
data_suffix=_data_suffix('m'),
278283
config_file=self.cov_config,
279284
)
280285
self.cov._warn_no_data = False
@@ -283,7 +288,7 @@ def start(self):
283288
self.combining_cov = coverage.Coverage(
284289
source=self.cov_source,
285290
branch=self.cov_branch,
286-
data_suffix=True,
291+
data_suffix=_data_suffix('mc'),
287292
data_file=os.path.abspath(self.cov.config.data_file), # noqa: PTH100
288293
config_file=self.cov_config,
289294
)
@@ -330,7 +335,7 @@ def testnodedown(self, node, error):
330335
data.read_fileobj(StringIO(output['cov_worker_data']))
331336
cov.data.update(data)
332337
else:
333-
data = CoverageData(no_disk=True)
338+
data = CoverageData(no_disk=True, suffix='should-not-exist')
334339
data.loads(output['cov_worker_data'])
335340
cov.get_data().update(data)
336341
cov.stop()
@@ -381,7 +386,7 @@ def start(self):
381386
self.cov = coverage.Coverage(
382387
source=self.cov_source,
383388
branch=self.cov_branch,
384-
data_suffix=True,
389+
data_suffix=_data_suffix(f'w{self.nodeid}'),
385390
config_file=self.cov_config,
386391
)
387392
self.cov.start()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy