def test_process_dump_env(self): arguments = [sys.executable, PROGRAM_DUMP_ENV] self.buffer = b'' self.returncode = None def on_exit(process_handle, returncode, term_signal): self.returncode = returncode def on_read(pipe_handle, status, data): self.buffer += data env = {'hello': 'world'} self.process = uv.Process(arguments, env=env, stdout=uv.PIPE, on_exit=on_exit, cwd=common.resolve_path('')) self.process.stdout.read_start(on_read) self.loop.run() self.assert_equal(self.returncode, 0) self.assert_not_equal(self.process.pid, None) result = json.loads(self.buffer.decode()) self.assert_equal(result['hello'], 'world') self.assert_true(result['cwd'].endswith('tests/data'))
# PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import print_function, unicode_literals, division, absolute_import import json import sys import common import uv PROGRAM_HELLO = common.resolve_path('program_hello.py') PROGRAM_ENDLESS_LOOP = common.resolve_path('program_endless_loop.py') PROGRAM_DUMP_ENV = common.resolve_path('program_dump_env.py') class TestProcess(common.TestCase): def test_process_hello(self): arguments = [sys.executable, PROGRAM_HELLO] self.buffer = b'' self.returncode = None def on_exit(process_handle, returncode, term_signal): self.returncode = returncode def on_read(pipe_handle, status, data):
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import print_function, unicode_literals, division, absolute_import import json import sys import common import uv PROGRAM_HELLO = common.resolve_path('program_hello.py') PROGRAM_ENDLESS_LOOP = common.resolve_path('program_endless_loop.py') PROGRAM_DUMP_ENV = common.resolve_path('program_dump_env.py') class TestProcess(common.TestCase): def test_process_hello(self): arguments = [sys.executable, PROGRAM_HELLO] self.buffer = b'' self.returncode = None def on_exit(process_handle, returncode, term_signal): self.returncode = returncode def on_read(pipe_handle, status, data):
# the Free Software Foundation. # # This program is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import print_function, unicode_literals, division, absolute_import import common import uv KEYFILE = common.resolve_path('server.key') CERTFILE = common.resolve_path('server.crt') @common.skip_interpreter('pypy') class TestSecure(common.TestCase): def test_secure(self): def on_client_handshake(handshake_request, status, ssl_error): import sys print('client handshake:', status, file=sys.stderr) self.client.close() def on_connect(connect_request, status): self.client.handshake(on_handshake=on_client_handshake) import sys print('client connection:', status, file=sys.stderr)
# # This program is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public License along # with this program. If not, see <http://www.gnu.org/licenses/>. from __future__ import print_function, unicode_literals, division, absolute_import import common import uv KEYFILE = common.resolve_path("server.key") CERTFILE = common.resolve_path("server.crt") @common.skip_interpreter("pypy") class TestSecure(common.TestCase): def test_secure(self): def on_client_handshake(handshake_request, status, ssl_error): import sys print("client handshake:", status, file=sys.stderr) self.client.close() def on_connect(connect_request, status): self.client.handshake(on_handshake=on_client_handshake) import sys