From 997f43d392a035b040a684adf9dded7be2239d5a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 25 Jul 2017 07:50:59 -0300 Subject: [PATCH 01/13] Add AppVeyor script --- appveyor.yml | 20 ++++++++++++++++++++ scripts/install-pypy.bat | 6 ++++++ 2 files changed, 26 insertions(+) create mode 100644 appveyor.yml create mode 100644 scripts/install-pypy.bat diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..44353cce --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,20 @@ +build: false +environment: + matrix: + - TOXENV: "py26" + - TOXENV: "py27" + - TOXENV: "py33" + - TOXENV: "py34" + - TOXENV: "pypy" + - TOXENV: "flakes" + +install: + - echo Installed Pythons + - dir c:\Python* + + - if "%TOXENV%" == "pypy" call scripts\install-pypy.bat + + - C:\Python35\python -m pip install tox + +test_script: + - C:\Python35\python -m tox diff --git a/scripts/install-pypy.bat b/scripts/install-pypy.bat new file mode 100644 index 00000000..8012ea46 --- /dev/null +++ b/scripts/install-pypy.bat @@ -0,0 +1,6 @@ +REM install pypy using choco +REM redirect to a file because choco install python.pypy is too noisy. If the command fails, write output to console +choco install python.pypy > pypy-inst.log 2>&1 || (type pypy-inst.log & exit /b 1) +set PATH=C:\tools\pypy\pypy;%PATH% # so tox can find pypy +echo PyPy installed +pypy --version From 8634b7ad83e24fd02bddbeda9add2d3e3c3c9da2 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 25 Jul 2017 07:54:09 -0300 Subject: [PATCH 02/13] Rename README.txt to README.rst to better render on GH --- README.txt => README.rst | 0 setup.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename README.txt => README.rst (100%) diff --git a/README.txt b/README.rst similarity index 100% rename from README.txt rename to README.rst diff --git a/setup.py b/setup.py index 64cf8d72..c0e4b114 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ def main(): from setuptools import setup - with open("README.txt") as fp: + with open("README.rst") as fp: readme = fp.read() setup( name='execnet', From 74b7b729da6742a9cf161f4ea75765a08fb9b321 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 25 Jul 2017 07:56:17 -0300 Subject: [PATCH 03/13] Update trove classifiers --- setup.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index c0e4b114..4a3c8137 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def main(): author='holger krekel and others', author_email='holger at merlinux.eu', classifiers=[ - 'Development Status :: 4 - Beta', + 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Operating System :: POSIX', @@ -22,8 +22,14 @@ def main(): 'Topic :: Software Development :: Libraries', 'Topic :: System :: Distributed Computing', 'Topic :: System :: Networking', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3'], + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.6', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: Implementation :: PyPy', + ], packages=['execnet', 'execnet.script'], install_requires=['apipkg>=1.4'], setup_requires=['setuptools_scm'], From 99f900869d40ab462bcf2432dc04529a1e1d5261 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 25 Jul 2017 08:03:51 -0300 Subject: [PATCH 04/13] Add badges to README --- README.rst | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.rst b/README.rst index cff01e08..63cac740 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,21 @@ execnet: distributed Python deployment and communication ======================================================== +.. image:: https://img.shields.io/pypi/v/execnet.svg + :target: https://pypi.org/project/execnet/ + +.. image:: https://anaconda.org/conda-forge/execnet/badges/version.svg + :target: https://anaconda.org/conda-forge/execnet + +.. image:: https://img.shields.io/pypi/pyversions/execnet.svg + :target: https://pypi.org/project/execnet/ + +.. image:: https://travis-ci.org/pytest-dev/execnet.svg?branch=master + :target: https://travis-ci.org/pytest-dev/execnet + +.. image:: https://ci.appveyor.com/api/projects/status/n9qy8df16my4gds9/branch/master?svg=true + :target: https://ci.appveyor.com/project/pytestbot/execnet + .. _execnet: http://codespeak.net/execnet execnet_ provides carefully tested means to ad-hoc interact with Python From a4a6958f894020ff46e8c48ca60bdeade553bed8 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 25 Jul 2017 20:05:07 -0300 Subject: [PATCH 05/13] Fix spec parsing on Windows due to path containing '\' characters. --- CHANGELOG | 3 +++ execnet/gateway_io.py | 13 ++++++++++++- testing/test_gateway.py | 5 ++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 0ef7514c..bc718725 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -22,8 +22,11 @@ enum features in 3.6). - fix #49 - use inspect.getfullargspec if possible to avoid deprecationwarnings + - fix #56 - use partials in safe_terminate to avoid a bad carried binding +- fix spec parsing on Windows due to path containing '\' characters. + 1.4.1 ------ diff --git a/execnet/gateway_io.py b/execnet/gateway_io.py index 528a2b9d..1979010c 100644 --- a/execnet/gateway_io.py +++ b/execnet/gateway_io.py @@ -67,8 +67,19 @@ def killpid(pid): popen_bootstrapline = "import sys;exec(eval(sys.stdin.readline()))" +def shell_split_path(path): + """ + Use shell lexer to split the given path into a list of components, + taking care to handle Windows' '\' correctly. + """ + if sys.platform.startswith('win'): + # replace \\ by / otherwise shlex will strip them out + path = path.replace('\\', '/') + return shlex.split(path) + + def popen_args(spec): - args = shlex.split(spec.python) if spec.python else [sys.executable] + args = shell_split_path(spec.python) if spec.python else [sys.executable] args.append('-u') if spec is not None and spec.dont_write_bytecode: args.append("-B") diff --git a/testing/test_gateway.py b/testing/test_gateway.py index ae35dd04..11c2a410 100644 --- a/testing/test_gateway.py +++ b/testing/test_gateway.py @@ -4,6 +4,8 @@ import os import py import pytest +import sys + import execnet from execnet import gateway_base, gateway_io from test_serializer import _find_version @@ -436,7 +438,8 @@ def test_3to2(self, makegateway): @pytest.mark.parametrize('spec, expected_args', [ ('popen//python=python', ['python']), ('popen//python=sudo -u test python', ['sudo', '-u', 'test', 'python']), - ('popen//python=/hans\ alt/bin/python', ['/hans alt/bin/python']), + pytest.param('popen//python=/hans\ alt/bin/python', ['/hans alt/bin/python'], + marks=pytest.mark.skipif(sys.platform.startswith('win'), reason='invalid spec on Windows')), ('popen//python="/u/test me/python" -e', ['/u/test me/python', '-e']), ]) def test_popen_args(spec, expected_args): From 4de253a3904c78f177d67056e79725a05105bd22 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Tue, 25 Jul 2017 20:10:09 -0300 Subject: [PATCH 06/13] Replace deprecated __multicall__ by proper hookwrapper --- testing/conftest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testing/conftest.py b/testing/conftest.py index ba73e0ea..63d043dd 100644 --- a/testing/conftest.py +++ b/testing/conftest.py @@ -19,13 +19,13 @@ } -def pytest_runtest_setup(item, __multicall__): +@pytest.hookimpl(hookwrapper=True) +def pytest_runtest_setup(item): if item.fspath.purebasename in ('test_group', 'test_info'): getspecssh(item.config) # will skip if no gx given - res = __multicall__.execute() + yield if 'pypy' in item.keywords and not item.config.option.pypy: py.test.skip("pypy tests skipped, use --pypy to run them.") - return res @pytest.fixture From 65d241a96fc4c35c0c4e4823b4d2b8df07afbf29 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 26 Jul 2017 19:26:30 -0300 Subject: [PATCH 07/13] xfail some tests on windows on pypy (#63) --- testing/test_basics.py | 6 ++++++ testing/test_gateway.py | 5 +++++ testing/test_termination.py | 5 +++++ testing/test_xspec.py | 8 ++++++++ 4 files changed, 24 insertions(+) diff --git a/testing/test_basics.py b/testing/test_basics.py index 277bdcb9..5face6ad 100644 --- a/testing/test_basics.py +++ b/testing/test_basics.py @@ -15,6 +15,10 @@ from io import BytesIO +skip_win_pypy = pytest.mark.xfail(condition=hasattr(sys, 'pypy_version_info') and sys.platform.startswith('win'), + reason='failing on Windows on PyPy (#63)') + + class TestSerializeAPI: pytestmark = [ pytest.mark.parametrize("val", [ @@ -369,6 +373,7 @@ def f(channel): assert self.check(f) == [] +@skip_win_pypy def test_remote_exec_function_with_kwargs(anypython, makegateway): def func(channel, data): channel.send(data) @@ -386,6 +391,7 @@ def test_remote_exc__no_kwargs(makegateway): pytest.raises(TypeError, gw.remote_exec, 'pass', kwarg=1) +@skip_win_pypy def test_remote_exec_inspect_stack(makegateway): gw = makegateway() ch = gw.remote_exec(""" diff --git a/testing/test_gateway.py b/testing/test_gateway.py index 11c2a410..6f0f62b3 100644 --- a/testing/test_gateway.py +++ b/testing/test_gateway.py @@ -13,6 +13,10 @@ needs_osdup = py.test.mark.skipif("not hasattr(os, 'dup')") +skip_win_pypy = pytest.mark.xfail(condition=hasattr(sys, 'pypy_version_info') and sys.platform.startswith('win'), + reason='failing on Windows on PyPy (#63)') + + def fails(*args, **kwargs): 0/0 @@ -384,6 +388,7 @@ def test_popen_filetracing(self, testdir, monkeypatch, makegateway): py.test.fail("did not find %r in tracefile" % (slave_line,)) gw.exit() + @skip_win_pypy def test_popen_stderr_tracing(self, capfd, monkeypatch, makegateway): monkeypatch.setenv('EXECNET_DEBUG', "2") gw = makegateway("popen") diff --git a/testing/test_termination.py b/testing/test_termination.py index 87086b9f..7320cdfe 100644 --- a/testing/test_termination.py +++ b/testing/test_termination.py @@ -3,9 +3,13 @@ import apipkg import subprocess import py +import sys from test_gateway import TESTTIMEOUT execnetdir = py.path.local(execnet.__file__).dirpath().dirpath() +skip_win_pypy = pytest.mark.xfail(condition=hasattr(sys, 'pypy_version_info') and sys.platform.startswith('win'), + reason='failing on Windows on PyPy (#63)') + def test_exit_blocked_slave_execution_gateway(anypython, makegateway, pool): gateway = makegateway('popen//python=%s' % anypython) @@ -42,6 +46,7 @@ def test_endmarker_delivery_on_remote_killterm(makegateway, execmodel): assert isinstance(err, EOFError) +@skip_win_pypy def test_termination_on_remote_channel_receive(monkeypatch, makegateway): if not py.path.local.sysfind('ps'): py.test.skip("need 'ps' command to externally check process status") diff --git a/testing/test_xspec.py b/testing/test_xspec.py index 7856ef6d..cbb20554 100644 --- a/testing/test_xspec.py +++ b/testing/test_xspec.py @@ -9,6 +9,10 @@ XSpec = execnet.XSpec +skip_win_pypy = pytest.mark.xfail(condition=hasattr(sys, 'pypy_version_info') and sys.platform.startswith('win'), + reason='failing on Windows on PyPy (#63)') + + class TestXSpec: def test_norm_attributes(self): spec = XSpec("socket=192.168.102.2:8888//python=c:/this/python2.5" @@ -109,6 +113,7 @@ class TestMakegateway: def test_no_type(self, makegateway): pytest.raises(ValueError, lambda: makegateway('hello')) + @skip_win_pypy def test_popen_default(self, makegateway): gw = makegateway("") assert gw.spec.popen @@ -144,6 +149,7 @@ def test_popen_env(self, makegateway): value = ch.receive() assert value == "123" + @skip_win_pypy def test_popen_explicit(self, makegateway): gw = makegateway("popen//python=%s" % sys.executable) assert gw.spec.python == sys.executable @@ -180,11 +186,13 @@ def test_popen_cpython26(self, makegateway): assert rinfo.cwd == os.getcwd() assert rinfo.version_info[:2] == (2, 6) + @skip_win_pypy def test_popen_chdir_absolute(self, testdir, makegateway): gw = makegateway("popen//chdir=%s" % testdir.tmpdir) rinfo = gw._rinfo() assert rinfo.cwd == str(testdir.tmpdir.realpath()) + @skip_win_pypy def test_popen_chdir_newsub(self, testdir, makegateway): testdir.chdir() gw = makegateway("popen//chdir=hello") From 21e4d779725d6fa4914f080a02117cd6d48fde54 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 26 Jul 2017 19:28:05 -0300 Subject: [PATCH 08/13] Update travis to test py26-py36 and pypy using tox-travis --- .travis.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/.travis.yml b/.travis.yml index b9f8dc1f..e8993495 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,18 @@ language: python -cache: pip python: -- '2.7' -- '3.6' -- pypy + - '2.6' + - '2.7' + - '3.3' + - '3.4' + - '3.5' + - '3.6' + - pypy install: -- pip install -U pip -- pip install -U setuptools setuptools_scm pytest -- pip install -e . + - pip install -U pip + - pip install -U tox-travis -script: pytest testing +script: + - tox notifications: irc: @@ -17,4 +20,4 @@ notifications: - "chat.freenode.net#pylib" on_success: change on_failure: change - skip_join: true \ No newline at end of file + skip_join: true From 40ca902acfcd1891e5355d497bd054f5bca17d52 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 26 Jul 2017 19:29:31 -0300 Subject: [PATCH 09/13] Cleanup tox.ini file Remove environments which are no longer in use --- .travis.yml | 2 +- tox.ini | 50 +++----------------------------------------------- 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/.travis.yml b/.travis.yml index e8993495..80271d96 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ python: - '3.4' - '3.5' - '3.6' - - pypy + - 'pypy' install: - pip install -U pip - pip install -U tox-travis diff --git a/tox.ini b/tox.ini index 3cb240a4..b69549fe 100644 --- a/tox.ini +++ b/tox.ini @@ -1,59 +1,15 @@ [tox] -envlist=py26,py27,py33,py34,pypy,flakes +envlist=py26,py27,py33,py34,py35,py36,pypy [testenv] changedir=testing deps= - apipkg pytest pytest-timeout -commands=py.test -rsfxX {posargs} - -[testenv:flakes] -changedir= -deps= flake8 -commands = flake8 setup.py execnet testing - -[testenv:jython] -commands=jython -m pytest -rsfxX {posargs} - -[testenv:docs] -basepython=python -changedir=doc -deps=sphinx - pytest - apipkg -commands= - py.test -rsfxX -v check_sphinx.py - -[testenv:subprocess32] -basepython=python2.7 -deps=pytest - pytest-timeout - subprocess32 - apipkg - -[testenv:upload-devpi] -changedir=. -deps=hgdistver - wheel - devpi -commands= - devpi upload --no-vcs --formats sdist,bdist_wheel - -[testenv:upload-release] -changedir=. -deps=hgdistver - wheel - setuptools -commands= - python setup.py register sdist bdist_wheel upload - +commands=py.test {testing:posargs} [pytest] timeout = 20 -addopts = -rxXs +addopts = -ra rsyncdirs = execnet testing -[flake8] -exclude = .env/,.tox/,build/,dist/,execnet/apipkg.py From 0a506f4fb16451534c0e4a8e6c8661274b100a6a Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 26 Jul 2017 19:51:05 -0300 Subject: [PATCH 10/13] Remove flake and add py35 and py36 to appveyor --- appveyor.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 44353cce..f2b7383f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,8 +5,9 @@ environment: - TOXENV: "py27" - TOXENV: "py33" - TOXENV: "py34" + - TOXENV: "py35" + - TOXENV: "py36" - TOXENV: "pypy" - - TOXENV: "flakes" install: - echo Installed Pythons @@ -14,7 +15,7 @@ install: - if "%TOXENV%" == "pypy" call scripts\install-pypy.bat - - C:\Python35\python -m pip install tox + - C:\Python36\python -m pip install tox test_script: - - C:\Python35\python -m tox + - C:\Python36\python -m tox From 8b44715a0c7f7aff7f6523db65d154bdef4a2cad Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 26 Jul 2017 19:54:58 -0300 Subject: [PATCH 11/13] Fix substitution in tox.ini --- tox.ini | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index b69549fe..95ea9264 100644 --- a/tox.ini +++ b/tox.ini @@ -2,11 +2,10 @@ envlist=py26,py27,py33,py34,py35,py36,pypy [testenv] -changedir=testing deps= pytest pytest-timeout -commands=py.test {testing:posargs} +commands=py.test {posargs:testing} [pytest] timeout = 20 From 73c463755551c6bea1f30d540214a8af683ff0b6 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 27 Jul 2017 21:10:51 -0300 Subject: [PATCH 12/13] Mark another test as xfail on PyPy --- testing/test_fixes.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/testing/test_fixes.py b/testing/test_fixes.py index 7043c53b..8ee31a25 100644 --- a/testing/test_fixes.py +++ b/testing/test_fixes.py @@ -1,3 +1,6 @@ +import pytest +import sys + from execnet import Group from execnet.gateway_bootstrap import fix_pid_for_jython_popen @@ -11,6 +14,8 @@ def test_jython_bootstrap_not_on_remote(): group.terminate(timeout=1.0) +@pytest.mark.xfail(condition=hasattr(sys, 'pypy_version_info') and sys.platform.startswith('win'), + reason='failing on Windows on PyPy (#63)') def test_jython_bootstrap_fix(): group = Group() gw = group.makegateway('popen') From f19a2f07702d4d95d57b56c396cfe22b76f5bfc2 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Thu, 27 Jul 2017 21:21:03 -0300 Subject: [PATCH 13/13] Use complex value with exact representation in float 3.14j would generate `'(1.78+3.1400000000000001j)'` on py26 --- testing/test_serializer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/test_serializer.py b/testing/test_serializer.py index cdb9317c..1cb47f5e 100644 --- a/testing/test_serializer.py +++ b/testing/test_serializer.py @@ -128,7 +128,7 @@ def load(request): # type: expected before/after repr ('int', '4'), ('float', '3.25'), - ('complex', '(1.78+3.14j)'), + ('complex', '(1.78+3.25j)'), ('list', '[1, 2, 3]'), ('tuple', '(1, 2, 3)'), ('dict', '{(1, 2, 3): 32}'),