From affdb2fdc05068c15df0ade7b1c13f315f4c273f Mon Sep 17 00:00:00 2001 From: Dmitri Bogomolov <4glitch@gmail.com> Date: Thu, 20 Feb 2020 14:14:25 +0200 Subject: [PATCH] Solve problem with subprocess.call() on windows: - uncomment console_scripts (only for windows) to get exe - replace call() with Popen() to avoid blocking --- setup.py | 7 ++++--- src/tests/test_process.py | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 14a023be..67faed76 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ import os import shutil +import sys from setuptools import setup, Extension from setuptools.command.install import install @@ -146,9 +147,9 @@ if __name__ == "__main__": 'bitmessage.proxyconfig': [ 'stem = pybitmessage.plugins.proxyconfig_stem [tor]' ], - # 'console_scripts': [ - # 'pybitmessage = pybitmessage.bitmessagemain:main' - # ] + 'console_scripts': [ + 'pybitmessage = pybitmessage.bitmessagemain:main' + ] if sys.platform[:3] == 'win' else [] }, scripts=['src/pybitmessage'], cmdclass={'install': InstallCmd}, diff --git a/src/tests/test_process.py b/src/tests/test_process.py index a347f456..3e9d326b 100644 --- a/src/tests/test_process.py +++ b/src/tests/test_process.py @@ -35,7 +35,9 @@ class TestProcessProto(unittest.TestCase): cls.flag = False cls.home = os.environ['BITMESSAGE_HOME'] = tempfile.gettempdir() put_signal_file(cls.home, 'unittest.lock') - subprocess.call(cls._process_cmd) # nosec + subprocess.Popen( + cls._process_cmd, + stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # nosec time.sleep(5) try: cls.pid = int(cls._get_readline('singleton.lock'))