tests/sitecustomize.py
author Raphaël Gomès <rgomes@octobus.net>
Fri, 19 Feb 2021 17:52:04 +0100
branchstable
changeset 46376 b994db7c4d1e
parent 43076 2372284d9457
child 48966 6000f5b25c9b
permissions -rw-r--r--
narrow: fix flaky behavior described in issue6150 This has been plaguing the CI for a good while, and it doesn't appear to have an easy fix proposed yet. The solution in this change is to always do an unambiguous (but expensive) lookup in case of comparison. This should always be correct, albeit suboptimal. Differential Revision: https://phab.mercurial-scm.org/D10034

from __future__ import absolute_import
import os

if os.environ.get('COVERAGE_PROCESS_START'):
    try:
        import coverage
        import uuid

        covpath = os.path.join(
            os.environ['COVERAGE_DIR'], 'cov.%s' % uuid.uuid1()
        )
        cov = coverage.coverage(data_file=covpath, auto_data=True)
        cov._warn_no_data = False
        cov._warn_unimported_source = False
        cov.start()
    except ImportError:
        pass