From cfe9c9c169aeff4a74d0f2a9c70a7badd41ec166 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 21 Apr 2015 15:55:48 +0200 Subject: [PATCH 1/4] strike drone badge as it doesn't make sense on PYPI (where the README is rendered) --HG-- branch : nodrone --- README.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.rst b/README.rst index 180a2ecbf..704536932 100644 --- a/README.rst +++ b/README.rst @@ -1,5 +1,3 @@ -.. image:: https://drone.io/bitbucket.org/pytest-dev/pytest/status.png - :target: https://drone.io/bitbucket.org/pytest-dev/pytest/latest .. image:: https://pypip.in/v/pytest/badge.png :target: https://pypi.python.org/pypi/pytest From 9d5182eaad5e01949e9da5ac6bec9eb83a6bc33e Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 22 Apr 2015 17:06:00 +0200 Subject: [PATCH 2/4] reintroduced _pytest fixture of the pytester plugin which is used at least by pytest-xdist. --HG-- branch : reintroduce_pytest_fixture --- CHANGELOG | 2 ++ _pytest/pytester.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index bd5b2eb81..4ffce2dcd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -24,6 +24,8 @@ - fixed regression to 2.6.4 which surfaced e.g. in lost stdout capture printing when tests raised SystemExit. Thanks Holger Krekel. +- reintroduced _pytest fixture of the pytester plugin which is used + at least by pytest-xdist. 2.7.0 (compared to 2.6.4) ----------------------------- diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 7057814ff..404e07fa9 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -15,6 +15,19 @@ from _pytest.core import HookCaller, add_method_wrapper from _pytest.main import Session, EXIT_OK +# used at least by pytest-xdist plugin +def pytest_funcarg___pytest(request): + return PytestArg(request) + +class PytestArg: + def __init__(self, request): + self.request = request + + def gethookrecorder(self, hook): + hookrecorder = HookRecorder(hook._pm) + self.request.addfinalizer(hookrecorder.finish_recording) + return hookrecorder + def get_public_names(l): """Only return names from iterator l without a leading underscore.""" From a3aebfaefe366d19fafd65588475993e34d096d4 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Wed, 22 Apr 2015 21:04:36 +0200 Subject: [PATCH 3/4] accomodate Floris' comments. (The reason was i just reinstanted the old code :) --HG-- branch : reintroduce_pytest_fixture --- _pytest/pytester.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/_pytest/pytester.py b/_pytest/pytester.py index 404e07fa9..0a85d3d60 100644 --- a/_pytest/pytester.py +++ b/_pytest/pytester.py @@ -16,7 +16,12 @@ from _pytest.core import HookCaller, add_method_wrapper from _pytest.main import Session, EXIT_OK # used at least by pytest-xdist plugin -def pytest_funcarg___pytest(request): +@pytest.fixture +def _pytest(request): + """ Return a helper which offers a gethookrecorder(hook) + method which returns a HookRecorder instance which helps + to make assertions about called hooks. + """ return PytestArg(request) class PytestArg: From 6fe5493c3c84cfc3b766b8196f0913ab5717f589 Mon Sep 17 00:00:00 2001 From: Bruno Oliveira Date: Wed, 22 Apr 2015 19:46:06 -0300 Subject: [PATCH 4/4] Fix py27-cxfreeze tox environment Use a custom script to install a patched version of cx_freeze, as required in Ubuntu 14.04 systems --HG-- branch : cx_freeze_ubuntu --- .hgignore | 2 + testing/cx_freeze/install_cx_freeze.py | 66 ++++++++++++++++++++++++++ tox.ini | 2 +- 3 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 testing/cx_freeze/install_cx_freeze.py diff --git a/.hgignore b/.hgignore index 398044a1a..16257ba78 100644 --- a/.hgignore +++ b/.hgignore @@ -25,6 +25,8 @@ syntax:glob doc/*/_build build/ dist/ +testing/cx_freeze/build +testing/cx_freeze/cx_freeze_source *.egg-info issue/ env/ diff --git a/testing/cx_freeze/install_cx_freeze.py b/testing/cx_freeze/install_cx_freeze.py new file mode 100644 index 000000000..801c3b2c8 --- /dev/null +++ b/testing/cx_freeze/install_cx_freeze.py @@ -0,0 +1,66 @@ +""" +Installs cx_freeze from source, but first patching +setup.py as described here: + +http://stackoverflow.com/questions/25107697/compiling-cx-freeze-under-ubuntu +""" +import glob +import shutil +import tarfile +import os +import sys +import platform + +if __name__ == '__main__': + if 'ubuntu' not in platform.version().lower(): + + print('Not Ubuntu, installing using pip. (platform.version() is %r)' % + platform.version()) + res = os.system('pip install cx_freeze') + if res != 0: + sys.exit(res) + sys.exit(0) + + if os.path.isdir('cx_freeze_source'): + shutil.rmtree('cx_freeze_source') + os.mkdir('cx_freeze_source') + + res = os.system('pip install --download cx_freeze_source --no-use-wheel ' + 'cx_freeze') + if res != 0: + sys.exit(res) + + packages = glob.glob('cx_freeze_source/*.tar.gz') + assert len(packages) == 1 + tar_filename = packages[0] + + tar_file = tarfile.open(tar_filename) + try: + tar_file.extractall(path='cx_freeze_source') + finally: + tar_file.close() + + basename = os.path.basename(tar_filename).replace('.tar.gz', '') + setup_py_filename = 'cx_freeze_source/%s/setup.py' % basename + with open(setup_py_filename) as f: + lines = f.readlines() + + line_to_patch = 'if not vars.get("Py_ENABLE_SHARED", 0):' + for index, line in enumerate(lines): + if line_to_patch in line: + indent = line[:line.index(line_to_patch)] + lines[index] = indent + 'if True:\n' + print('Patched line %d' % (index + 1)) + break + else: + sys.exit('Could not find line in setup.py to patch!') + + with open(setup_py_filename, 'w') as f: + f.writelines(lines) + + os.chdir('cx_freeze_source/%s' % basename) + res = os.system('python setup.py install') + if res != 0: + sys.exit(res) + + sys.exit(0) \ No newline at end of file diff --git a/tox.ini b/tox.ini index 73502d4d4..9f683c46f 100644 --- a/tox.ini +++ b/tox.ini @@ -125,10 +125,10 @@ commands= -rfsxX --junitxml={envlogdir}/junit-{envname}2.xml [] [testenv:py27-cxfreeze] -deps=cx_freeze changedir=testing/cx_freeze basepython=python2.7 commands= + {envpython} install_cx_freeze.py {envpython} runtests_setup.py build --build-exe build {envpython} tox_run.py