Patchwork D6960: run-tests: make coverage work out of tree

login
register
mail settings
Submitter phabricator
Date Oct. 4, 2019, 5:21 p.m.
Message ID <differential-rev-PHID-DREV-mqhwrbhcezmm6lreji5x-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41951/
State Superseded
Headers show

Comments

phabricator - Oct. 4, 2019, 5:21 p.m.
Kwan created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Currently coverage fails when run on an out-of-tree extension since
  run-tests.py tries to load sitecustomize.py from self._testdir, which is the
  dir for the extension's tests.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D6960

AFFECTED FILES
  tests/run-tests.py

CHANGE DETAILS




To: Kwan, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3170,7 +3170,7 @@ 
                 print('WARNING: cannot fix hg.bat reference to python.exe')
 
         if self.options.anycoverage:
-            custom = os.path.join(self._testdir, 'sitecustomize.py')
+            custom = os.path.join(osenvironb[b'RUNTESTDIR'], 'sitecustomize.py')
             target = os.path.join(self._pythondir, 'sitecustomize.py')
             vlog('# Installing coverage trigger to %s' % target)
             shutil.copyfile(custom, target)