summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-02-21 11:21:56 -0800
committerGiampaolo Rodola <g.rodola@gmail.com>2019-02-21 11:21:56 -0800
commit9eb7498412289e2f2a3ed7b9326d17ab74d4ee12 (patch)
tree5583abf112a27264e91239ca3b3773a3bdd072e9
parent4beeca825cf6c2a796088c8a61a3c8378d7985c4 (diff)
downloadpsutil-9eb7498412289e2f2a3ed7b9326d17ab74d4ee12.tar.gz
fix windows test
-rw-r--r--psutil/tests/__init__.py7
-rwxr-xr-xpsutil/tests/test_connections.py2
2 files changed, 6 insertions, 3 deletions
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py
index c6fc8cc2..b1c3c7b3 100644
--- a/psutil/tests/__init__.py
+++ b/psutil/tests/__init__.py
@@ -321,8 +321,11 @@ def get_test_subprocess(cmd=None, **kwds):
kwds.setdefault("cwd", os.getcwd())
kwds.setdefault("env", os.environ)
if WINDOWS:
- # Prevents the subprocess to open error dialogs.
- kwds.setdefault("creationflags", 0x8000000) # CREATE_NO_WINDOW
+ # Prevents the subprocess to open error dialogs. This will also
+ # cause stderr to be suppressed, which is suboptimal in order
+ # to debug broken tests.
+ CREATE_NO_WINDOW = 0x8000000
+ kwds.setdefault("creationflags", CREATE_NO_WINDOW)
if cmd is None:
safe_rmpath(_TESTFN)
pyline = "from time import sleep;" \
diff --git a/psutil/tests/test_connections.py b/psutil/tests/test_connections.py
index 7f59a74c..c97fc409 100755
--- a/psutil/tests/test_connections.py
+++ b/psutil/tests/test_connections.py
@@ -474,7 +474,7 @@ class TestSystemWideConnections(Base, unittest.TestCase):
import time, os
from psutil.tests import create_sockets
with create_sockets():
- with open('%s', 'w') as f:
+ with open(r'%s', 'w') as f:
f.write(str(os.getpid()))
time.sleep(60)
""" % fname)