Patchwork run-tests: replace '/dev/null' with os.devnull for Windows

login
register
mail settings
Submitter Matt Harbison
Date Aug. 31, 2018, 2:23 a.m.
Message ID <af23d7eb2666528e52ba.1535682232@Envy>
Download mbox | patch
Permalink /patch/34199/
State Accepted
Headers show

Comments

Matt Harbison - Aug. 31, 2018, 2:23 a.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1535600398 14400
#      Wed Aug 29 23:39:58 2018 -0400
# Node ID af23d7eb2666528e52baaa0d3a2d6d4ae2061646
# Parent  6827d3f47d4f1bab01a0cc92d7d9bfc52ee9f535
run-tests: replace '/dev/null' with os.devnull for Windows

Many of the *.py tests were dying on:

    File "c:\Users\Matt\projects\hg\hgdemandimport\tracing.py", line 27, in log
      _pipe = open(os.environ['HGCATAPULTSERVERPIPE'], 'w', 1)
  IOError: [Errno 2] $ENOENT$: '/dev/null'
via Mercurial-devel - Aug. 31, 2018, 4:17 a.m.
On Thu, Aug 30, 2018 at 7:24 PM Matt Harbison <mharbison72@gmail.com> wrote:

> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1535600398 14400
> #      Wed Aug 29 23:39:58 2018 -0400
> # Node ID af23d7eb2666528e52baaa0d3a2d6d4ae2061646
> # Parent  6827d3f47d4f1bab01a0cc92d7d9bfc52ee9f535
> run-tests: replace '/dev/null' with os.devnull for Windows
>

Queued, thanks!

Patch

diff --git a/tests/run-tests.py b/tests/run-tests.py
--- a/tests/run-tests.py
+++ b/tests/run-tests.py
@@ -1072,7 +1072,7 @@  class Test(unittest.TestCase):
         env["HGHOSTNAME"] = "test-hostname"
         env['HGIPV6'] = str(int(self._useipv6))
         if 'HGCATAPULTSERVERPIPE' not in env:
-            env['HGCATAPULTSERVERPIPE'] = '/dev/null'
+            env['HGCATAPULTSERVERPIPE'] = os.devnull
 
         extraextensions = []
         for opt in self._extraconfigopts:
@@ -1390,7 +1390,7 @@  class TTest(Test):
             script.append(b'alias pwd="pwd -W"\n')
 
         hgcatapult = os.getenv('HGCATAPULTSERVERPIPE')
-        if hgcatapult and hgcatapult != '/dev/null':
+        if hgcatapult and hgcatapult != os.devnull:
             # Kludge: use a while loop to keep the pipe from getting
             # closed by our echo commands. The still-running file gets
             # reaped at the end of the script, which causes the while