# HG changeset patch
# User Dan Villiom Podlaski Christiansen <danchr@gmail.com>
# Date 1637535758 -3600
#      Mon Nov 22 00:02:38 2021 +0100
# Node ID 0a0849f290ccf89ec63219151c20313031b6880a
# Parent  f59d751b42acd343c3007b26bb77f19a110e7ce8
coverage: write result to outputdir (tests by default)

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -8,4 +8,4 @@
 *.orig
 \#*\#
 .\#*
-
+.coverage
diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -3948,12 +3948,17 @@
         # output.
         os.chdir(self._hgroot)
         covdir = os.path.join(_bytes2sys(self._installdir), '..', 'coverage')
-        cov = coverage(data_file=os.path.join(covdir, 'cov'))
+        cov = coverage(
+            data_file=os.path.join(_bytes2sys(self._outputdir), '.coverage'),
+        )
 
         # Map install directory paths back to source directory.
         cov.config.paths['srcdir'] = ['.', _bytes2sys(self._pythondir)]
 
-        cov.combine()
+        cov.combine(data_paths=[
+            os.path.join(covdir, p) for p in os.listdir(covdir)
+        ])
+        cov.save()
 
         omit = [
             _bytes2sys(os.path.join(x, b'*'))