From commits-noreply at bitbucket.org Fri Jan 6 21:37:37 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 06 Jan 2012 20:37:37 -0000 Subject: [py-svn] commit/pytest: 5 new changesets Message-ID: <20120106203737.7287.23679@bitbucket13.managed.contegix.com> 5 new commits in pytest: https://bitbucket.org/hpk42/pytest/changeset/cdf022434243/ changeset: cdf022434243 user: schmir date: 2012-01-04 12:40:57 summary: test that a second undo doesn't change sys.path also use a 'mp' funcarg that restores sys.path and the current working directory in preparation for the monkeypatch.chdir method. affected #: 1 file diff -r e3065c26d6f5757e9516f8fcd69bb07844612c56 -r cdf02243424336364da819db2a2239f373be1ca9 testing/test_monkeypatch.py --- a/testing/test_monkeypatch.py +++ b/testing/test_monkeypatch.py @@ -2,6 +2,17 @@ import pytest from _pytest.monkeypatch import monkeypatch as MonkeyPatch +def pytest_funcarg__mp(request): + cwd = os.getcwd() + sys_path = list(sys.path) + + def cleanup(): + sys.path[:] = sys_path + os.chdir(cwd) + + request.addfinalizer(cleanup) + return MonkeyPatch() + def test_setattr(): class A: x = 1 @@ -144,19 +155,20 @@ res = reprec.countoutcomes() assert tuple(res) == (1, 0, 0), res -def test_syspath_prepend(): +def test_syspath_prepend(mp): old = list(sys.path) - try: - monkeypatch = MonkeyPatch() - monkeypatch.syspath_prepend('world') - monkeypatch.syspath_prepend('hello') - assert sys.path[0] == "hello" - assert sys.path[1] == "world" - monkeypatch.undo() - assert sys.path == old - monkeypatch.undo() - assert sys.path == old - finally: - sys.path[:] = old + mp.syspath_prepend('world') + mp.syspath_prepend('hello') + assert sys.path[0] == "hello" + assert sys.path[1] == "world" + mp.undo() + assert sys.path == old + mp.undo() + assert sys.path == old - +def test_syspath_prepend_double_undo(mp): + mp.syspath_prepend('hello world') + mp.undo() + sys.path.append('more hello world') + mp.undo() + assert sys.path[-1] == 'more hello world' https://bitbucket.org/hpk42/pytest/changeset/2e1969572830/ changeset: 2e1969572830 user: schmir date: 2012-01-04 12:42:23 summary: make sure calling undo a second time doesn't change sys.path affected #: 1 file diff -r cdf02243424336364da819db2a2239f373be1ca9 -r 2e1969572830eefd87c486a6a6a7b91702aa6bfa _pytest/monkeypatch.py --- a/_pytest/monkeypatch.py +++ b/_pytest/monkeypatch.py @@ -104,3 +104,4 @@ self._setitem[:] = [] if hasattr(self, '_savesyspath'): sys.path[:] = self._savesyspath + del self._savesyspath https://bitbucket.org/hpk42/pytest/changeset/03972d3a10e6/ changeset: 03972d3a10e6 user: schmir date: 2012-01-04 12:43:19 summary: add monkeypatch.chdir method affected #: 2 files diff -r 2e1969572830eefd87c486a6a6a7b91702aa6bfa -r 03972d3a10e6234ac72823fbe1a3b1c8240ca769 _pytest/monkeypatch.py --- a/_pytest/monkeypatch.py +++ b/_pytest/monkeypatch.py @@ -30,6 +30,7 @@ def __init__(self): self._setattr = [] self._setitem = [] + self._cwd = None def setattr(self, obj, name, value, raising=True): """ set attribute ``name`` on ``obj`` to ``value``, by default @@ -83,6 +84,14 @@ self._savesyspath = sys.path[:] sys.path.insert(0, str(path)) + def chdir(self, path): + if self._cwd is None: + self._cwd = os.getcwd() + if hasattr(path, "chdir"): + path.chdir() + else: + os.chdir(path) + def undo(self): """ undo previous changes. This call consumes the undo stack. Calling it a second time has no effect unless @@ -105,3 +114,7 @@ if hasattr(self, '_savesyspath'): sys.path[:] = self._savesyspath del self._savesyspath + + if self._cwd is not None: + os.chdir(self._cwd) + self._cwd = None diff -r 2e1969572830eefd87c486a6a6a7b91702aa6bfa -r 03972d3a10e6234ac72823fbe1a3b1c8240ca769 testing/test_monkeypatch.py --- a/testing/test_monkeypatch.py +++ b/testing/test_monkeypatch.py @@ -172,3 +172,24 @@ sys.path.append('more hello world') mp.undo() assert sys.path[-1] == 'more hello world' + +def test_chdir_with_path_local(mp, tmpdir): + mp.chdir(tmpdir) + assert os.getcwd() == tmpdir.strpath + +def test_chdir_with_str(mp, tmpdir): + mp.chdir(tmpdir.strpath) + assert os.getcwd() == tmpdir.strpath + +def test_chdir_undo(mp, tmpdir): + cwd = os.getcwd() + mp.chdir(tmpdir) + mp.undo() + assert os.getcwd() == cwd + +def test_chdir_double_undo(mp, tmpdir): + mp.chdir(tmpdir.strpath) + mp.undo() + tmpdir.chdir() + mp.undo() + assert os.getcwd() == tmpdir.strpath https://bitbucket.org/hpk42/pytest/changeset/a6fd5823d699/ changeset: a6fd5823d699 user: schmir date: 2012-01-06 15:25:57 summary: update documentation for the new monkeypatch.chdir method affected #: 2 files diff -r 03972d3a10e6234ac72823fbe1a3b1c8240ca769 -r a6fd5823d699b65eb75db11f69ca47cdac0fff3f CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -9,6 +9,7 @@ test directory was renamed and some pyc/__pycache__ remain - fix issue106: allow parametrize to be applied multiple times e.g. from module, class and at function level. +- add chdir method to monkeypatch funcarg Changes between 2.2.0 and 2.2.1 ---------------------------------------- diff -r 03972d3a10e6234ac72823fbe1a3b1c8240ca769 -r a6fd5823d699b65eb75db11f69ca47cdac0fff3f _pytest/monkeypatch.py --- a/_pytest/monkeypatch.py +++ b/_pytest/monkeypatch.py @@ -13,6 +13,7 @@ monkeypatch.setenv(name, value, prepend=False) monkeypatch.delenv(name, value, raising=True) monkeypatch.syspath_prepend(path) + monkeypatch.chdir(path) All modifications will be undone after the requesting test function has finished. The ``raising`` @@ -85,6 +86,9 @@ sys.path.insert(0, str(path)) def chdir(self, path): + """ change the current working directory to the specified path + path can be a string or a py.path.local object + """ if self._cwd is None: self._cwd = os.getcwd() if hasattr(path, "chdir"): https://bitbucket.org/hpk42/pytest/changeset/bbf6380d2776/ changeset: bbf6380d2776 user: hpk42 date: 2012-01-06 21:37:18 summary: bump version, mention "mp" also in the docs and changelog affected #: 4 files diff -r a6fd5823d699b65eb75db11f69ca47cdac0fff3f -r bbf6380d27762cbaaf38f09d41ac214686c1a606 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -10,6 +10,8 @@ - fix issue106: allow parametrize to be applied multiple times e.g. from module, class and at function level. - add chdir method to monkeypatch funcarg +- add "mp" funcargs as a shortcut for "monkeypatch" +- fix crash resulting from calling monkeypatch undo a second time Changes between 2.2.0 and 2.2.1 ---------------------------------------- diff -r a6fd5823d699b65eb75db11f69ca47cdac0fff3f -r bbf6380d27762cbaaf38f09d41ac214686c1a606 _pytest/__init__.py --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.2.2.dev5' +__version__ = '2.2.2.dev6' diff -r a6fd5823d699b65eb75db11f69ca47cdac0fff3f -r bbf6380d27762cbaaf38f09d41ac214686c1a606 doc/monkeypatch.txt --- a/doc/monkeypatch.txt +++ b/doc/monkeypatch.txt @@ -14,14 +14,14 @@ .. _`monkeypatch blog post`: http://tetamap.wordpress.com/2009/03/03/monkeypatching-in-unit-tests-done-right/ - -Simple example: patching ``os.path.expanduser`` +Simple example: monkeypatching functions --------------------------------------------------- -If, for instance, you want to pretend that ``os.expanduser`` returns a certain +If you want to pretend that ``os.expanduser`` returns a certain directory, you can use the :py:meth:`monkeypatch.setattr` method to patch this function before calling into a function which uses it:: + # content of test_module.py import os.path def getssh(): # pseudo application code return os.path.join(os.path.expanduser("~admin"), '.ssh') @@ -33,22 +33,20 @@ x = getssh() assert x == '/abc/.ssh' -After the test function finishes the ``os.path.expanduser`` modification -will be undone. +Here our test function monkeypatches ``os.path.expanduser`` and +then calls into an function that calls it. After the test function +finishes the ``os.path.expanduser`` modification will be undone. -.. background check: - $ py.test - =========================== test session starts ============================ - platform darwin -- Python 2.7.1 -- pytest-2.2.1 - collecting ... collected 0 items - - ============================= in 0.00 seconds ============================= +.. note:: + + As with version 2.2.2 there is a ``mp`` function argument + which is a shortcut for "monkeypatch". Method reference of the monkeypatch function argument ----------------------------------------------------- .. autoclass:: monkeypatch - :members: setattr, delattr, setitem, delitem, setenv, delenv, syspath_prepend, undo + :members: setattr, delattr, setitem, delitem, setenv, delenv, syspath_prepend, chdir, undo ``monkeypatch.setattr/delattr/delitem/delenv()`` all by default raise an Exception if the target does not exist. diff -r a6fd5823d699b65eb75db11f69ca47cdac0fff3f -r bbf6380d27762cbaaf38f09d41ac214686c1a606 setup.py --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ name='pytest', description='py.test: simple powerful testing with Python', long_description = long_description, - version='2.2.2.dev5', + version='2.2.2.dev6', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Fri Jan 6 21:40:48 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 06 Jan 2012 20:40:48 -0000 Subject: [py-svn] commit/pytest: hpk42: remove nonsennse part of commit related to "mp" shortcut. Message-ID: <20120106204048.7286.84461@bitbucket13.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/54353e58e520/ changeset: 54353e58e520 user: hpk42 date: 2012-01-06 21:40:14 summary: remove nonsennse part of commit related to "mp" shortcut. I wonder if introducing "mp" as a shortcut to monkeypatch is a good idea, actually :) affected #: 2 files diff -r bbf6380d27762cbaaf38f09d41ac214686c1a606 -r 54353e58e5209298fadd92ebb15619bf50ddbb55 CHANGELOG --- a/CHANGELOG +++ b/CHANGELOG @@ -10,7 +10,6 @@ - fix issue106: allow parametrize to be applied multiple times e.g. from module, class and at function level. - add chdir method to monkeypatch funcarg -- add "mp" funcargs as a shortcut for "monkeypatch" - fix crash resulting from calling monkeypatch undo a second time Changes between 2.2.0 and 2.2.1 diff -r bbf6380d27762cbaaf38f09d41ac214686c1a606 -r 54353e58e5209298fadd92ebb15619bf50ddbb55 doc/monkeypatch.txt --- a/doc/monkeypatch.txt +++ b/doc/monkeypatch.txt @@ -37,11 +37,6 @@ then calls into an function that calls it. After the test function finishes the ``os.path.expanduser`` modification will be undone. -.. note:: - - As with version 2.2.2 there is a ``mp`` function argument - which is a shortcut for "monkeypatch". - Method reference of the monkeypatch function argument ----------------------------------------------------- Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Thu Jan 19 20:53:30 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Thu, 19 Jan 2012 19:53:30 -0000 Subject: [py-svn] commit/pytest: hpk42: fix link to pdf from contents page Message-ID: <20120119195330.23354.94442@bitbucket03.managed.contegix.com> 1 new commit in pytest: https://bitbucket.org/hpk42/pytest/changeset/7c65025bc837/ changeset: 7c65025bc837 user: hpk42 date: 2012-01-19 20:53:21 summary: fix link to pdf from contents page affected #: 1 file diff -r 54353e58e5209298fadd92ebb15619bf50ddbb55 -r 7c65025bc83746433193c9abae3ae02e84b52d81 doc/contents.txt --- a/doc/contents.txt +++ b/doc/contents.txt @@ -4,7 +4,7 @@ Full pytest documenation ======================== -`Download latest version as PDF `_ +`Download latest version as PDF `_ .. `Download latest version as EPUB `_ Repository URL: https://bitbucket.org/hpk42/pytest/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Fri Jan 20 19:38:58 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 20 Jan 2012 18:38:58 -0000 Subject: [py-svn] commit/py: hpk42: implement rewriting functionality for TerminalWriter, Message-ID: <20120120183858.20840.876@bitbucket02.managed.contegix.com> 1 new commit in py: https://bitbucket.org/hpk42/py/changeset/e97d7c933a74/ changeset: e97d7c933a74 user: hpk42 date: 2012-01-20 19:38:44 summary: implement rewriting functionality for TerminalWriter, allowing to implement spinners by rewriting a line multiple times. affected #: 4 files diff -r bc37161ccd8c2fb1ff19662ffe154e6151b73a55 -r e97d7c933a74e34f45e704e8b129c67424cd11ce py/__init__.py --- a/py/__init__.py +++ b/py/__init__.py @@ -8,7 +8,7 @@ (c) Holger Krekel and others, 2004-2010 """ -__version__ = '1.4.7.dev2' +__version__ = '1.4.7.dev3' from py import _apipkg diff -r bc37161ccd8c2fb1ff19662ffe154e6151b73a55 -r e97d7c933a74e34f45e704e8b129c67424cd11ce py/_io/terminalwriter.py --- a/py/_io/terminalwriter.py +++ b/py/_io/terminalwriter.py @@ -105,6 +105,8 @@ Blue=44, Purple=45, Cyan=46, White=47, bold=1, light=2, blink=5, invert=7) + _newline = None # the last line printed + # XXX deprecate stringio argument def __init__(self, file=None, stringio=False, encoding=None): if file is None: @@ -180,8 +182,24 @@ return s def line(self, s='', **kw): + if self._newline == False: + self.write("\n") self.write(s, **kw) self.write('\n') + self._newline = True + + def reline(self, line, **opts): + if not self.hasmarkup: + raise ValueError("cannot use rewrite-line without terminal") + if not self._newline: + self.write("\r") + self.write(line, **opts) + lastlen = getattr(self, '_lastlinelen', None) + self._lastlinelen = lenlastline = len(line) + if lenlastline < lastlen: + self.write(" " * (lastlen - lenlastline + 1)) + self._newline = False + class Win32ConsoleWriter(TerminalWriter): def write(self, s, **kw): diff -r bc37161ccd8c2fb1ff19662ffe154e6151b73a55 -r e97d7c933a74e34f45e704e8b129c67424cd11ce setup.py --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ name='py', description='library with cross-python path, ini-parsing, io, code, log facilities', long_description = open('README.txt').read(), - version='1.4.7.dev2', + version='1.4.7.dev3', url='http://pylib.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff -r bc37161ccd8c2fb1ff19662ffe154e6151b73a55 -r e97d7c933a74e34f45e704e8b129c67424cd11ce testing/io_/test_terminalwriter.py --- a/testing/io_/test_terminalwriter.py +++ b/testing/io_/test_terminalwriter.py @@ -2,6 +2,7 @@ import os, sys from py._io import terminalwriter import codecs +import pytest def test_get_terminal_width(): x = py.io.get_terminal_width @@ -163,6 +164,26 @@ l = tw.getlines() assert len(l[0]) == len(l[1]) + def test_reline(self, tw): + tw.line("hello") + tw.hasmarkup = False + pytest.raises(ValueError, lambda: tw.reline("x")) + tw.hasmarkup = True + tw.reline("0 1 2") + l = "".join(tw.getlines()).split("\n") + assert len(l) == 2 + tw.reline("0 1 3") + l = "".join(tw.getlines()).split("\n") + assert len(l) == 2 + assert l[1].endswith("\r0 1 3") + tw.line("something") + l = "".join(tw.getlines()).split("\n") + assert len(l) == 4 + assert l[-1] == "" + out = "\n".join(l) + assert out.endswith("\nsomething\n") + + def test_attr_hasmarkup(): tw = py.io.TerminalWriter(stringio=True) Repository URL: https://bitbucket.org/hpk42/py/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Fri Jan 20 19:54:50 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Fri, 20 Jan 2012 18:54:50 -0000 Subject: [py-svn] commit/pytest-xdist: RonnyPfannschmidt: add a test to check deserialization of nonstandard test report attributes Message-ID: <20120120185450.20840.31605@bitbucket02.managed.contegix.com> 1 new commit in pytest-xdist: https://bitbucket.org/hpk42/pytest-xdist/changeset/1d2909839e98/ changeset: 1d2909839e98 user: RonnyPfannschmidt date: 2012-01-20 19:53:41 summary: add a test to check deserialization of nonstandard test report attributes affected #: 1 file diff -r 815039684ac977f374508103a48941b106dbb394 -r 1d2909839e98ddbac013b3ed303ed22e96616d8b testing/test_remote.py --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -121,6 +121,23 @@ if rep.failed: assert newrep.longrepr == str(rep.longrepr) + def test_extended_report_deserialization(self, testdir): + reprec = testdir.inline_runsource("qwe abc") + reports = reprec.getreports("pytest_collectreport") + assert reports + for rep in reports: + rep.extra = True + d = serialize_report(rep) + check_marshallable(d) + newrep = unserialize_report("collectreport", d) + assert newrep.extra + assert newrep.passed == rep.passed + assert newrep.failed == rep.failed + assert newrep.skipped == rep.skipped + if rep.failed: + assert newrep.longrepr == str(rep.longrepr) + + class TestSlaveInteractor: def test_basic_collect_and_runtests(self, slave): p = slave.testdir.makepyfile(""" Repository URL: https://bitbucket.org/hpk42/pytest-xdist/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Sun Jan 22 06:16:11 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Sun, 22 Jan 2012 05:16:11 -0000 Subject: [py-svn] commit/pytest-xdist: 6 new changesets Message-ID: <20120122051611.10270.13241@bitbucket01.managed.contegix.com> 6 new commits in pytest-xdist: https://bitbucket.org/hpk42/pytest-xdist/changeset/7648e66d2190/ changeset: 7648e66d2190 user: hpk42 date: 2011-12-16 11:47:33 summary: bump versions affected #: 2 files diff -r 4c9af0621fae3440b5e3e988e6b5fb2351fca3b7 -r 7648e66d2190ea4ffe585ad22621e314073546c8 setup.py --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name="pytest-xdist", - version='1.8.dev2', + version='1.8', description='py.test xdist plugin for distributed testing and loop-on-failing modes', long_description=open('README.txt').read(), license='GPLv2 or later', @@ -13,7 +13,7 @@ packages = ['xdist'], entry_points = {'pytest11': ['xdist = xdist.plugin'],}, zip_safe=False, - install_requires = ['execnet>=1.0.8', 'pytest>=2.2.1.dev2'], + install_requires = ['execnet>=1.0.8', 'pytest>=2.2.1'], classifiers=[ 'Development Status :: 5 - Production/Stable', 'Intended Audience :: Developers', @@ -27,4 +27,4 @@ 'Programming Language :: Python', 'Programming Language :: Python :: 3', ], -) +) \ No newline at end of file diff -r 4c9af0621fae3440b5e3e988e6b5fb2351fca3b7 -r 7648e66d2190ea4ffe585ad22621e314073546c8 xdist/__init__.py --- a/xdist/__init__.py +++ b/xdist/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '1.8.dev2' +__version__ = '1.8' https://bitbucket.org/hpk42/pytest-xdist/changeset/0d1c00018008/ changeset: 0d1c00018008 user: hpk42 date: 2011-12-16 12:47:28 summary: streamline MANIFEST file affected #: 1 file diff -r 7648e66d2190ea4ffe585ad22621e314073546c8 -r 0d1c00018008433956aa7d93007bab6ea7de96e4 MANIFEST.in --- a/MANIFEST.in +++ b/MANIFEST.in @@ -3,8 +3,4 @@ include README.txt include setup.py graft testing -exclude *.orig -exclude *.rej -recursive-exclude testing *.pyc *$py.class -prune .svn prune .hg https://bitbucket.org/hpk42/pytest-xdist/changeset/040a8cff7d60/ changeset: 040a8cff7d60 user: hpk42 date: 2011-12-16 12:57:23 summary: Added tag 1.8 for changeset 0d1c00018008 affected #: 1 file diff -r 0d1c00018008433956aa7d93007bab6ea7de96e4 -r 040a8cff7d60e984f90fda8fd13146ea8173fe0b .hgtags --- a/.hgtags +++ b/.hgtags @@ -10,3 +10,4 @@ 20875fed94e7f3dff50bdf762df91153b15ceca6 1.7 20875fed94e7f3dff50bdf762df91153b15ceca6 1.7 29c38e195526f5f0fdd651fb51f59d6efaaafbb0 1.7 +0d1c00018008433956aa7d93007bab6ea7de96e4 1.8 https://bitbucket.org/hpk42/pytest-xdist/changeset/1d27987c2675/ changeset: 1d27987c2675 user: hpk42 date: 2011-12-16 12:59:17 summary: merge affected #: 2 files diff -r 040a8cff7d60e984f90fda8fd13146ea8173fe0b -r 1d27987c267577899350a25ba5828d55d87083ad setup.py --- a/setup.py +++ b/setup.py @@ -27,4 +27,4 @@ 'Programming Language :: Python', 'Programming Language :: Python :: 3', ], -) \ No newline at end of file +) diff -r 040a8cff7d60e984f90fda8fd13146ea8173fe0b -r 1d27987c267577899350a25ba5828d55d87083ad testing/test_looponfail.py --- a/testing/test_looponfail.py +++ b/testing/test_looponfail.py @@ -88,16 +88,14 @@ assert not failures def test_failures_somewhere(self, testdir): - item = testdir.getitem("def test_func(): assert 0\n") + item = testdir.getitem("def test_func():\n assert 0\n") control = RemoteControl(item.config) control.setup() failures = control.runsession() assert failures control.setup() - item.fspath.write("def test_func(): assert 1\n") - pyc = item.fspath.new(ext=".pyc") - if pyc.check(): - pyc.remove() + item.fspath.write("def test_func():\n assert 1\n") + removepyc(item.fspath) topdir, failures = control.runsession()[:2] assert not failures @@ -115,9 +113,7 @@ def test_new(): assert 0 """)) - pyc = modcol.fspath.new(ext=".pyc") - if pyc.check(): - pyc.remove() + removepyc(modcol.fspath) control.loop_once() assert not control.failures control.loop_once() @@ -252,4 +248,7 @@ pyc = path + "c" if pyc.check(): pyc.remove() + c = path.dirpath("__pycache__") + if c.check(): + c.remove() https://bitbucket.org/hpk42/pytest-xdist/changeset/2bca332b5ef1/ changeset: 2bca332b5ef1 user: hpk42 date: 2011-12-16 12:59:21 summary: Added tag 1.8 for changeset 1d27987c2675 affected #: 1 file diff -r 1d27987c267577899350a25ba5828d55d87083ad -r 2bca332b5ef1fd55c91cd716df3759a610c19efa .hgtags --- a/.hgtags +++ b/.hgtags @@ -11,3 +11,5 @@ 20875fed94e7f3dff50bdf762df91153b15ceca6 1.7 29c38e195526f5f0fdd651fb51f59d6efaaafbb0 1.7 0d1c00018008433956aa7d93007bab6ea7de96e4 1.8 +0d1c00018008433956aa7d93007bab6ea7de96e4 1.8 +1d27987c267577899350a25ba5828d55d87083ad 1.8 https://bitbucket.org/hpk42/pytest-xdist/changeset/aaaecf0fade3/ changeset: aaaecf0fade3 user: hpk42 date: 2012-01-22 06:14:22 summary: merge affected #: 1 file diff -r 2bca332b5ef1fd55c91cd716df3759a610c19efa -r aaaecf0fade3fe063b75c2b577053a5d9e84bb2d testing/test_remote.py --- a/testing/test_remote.py +++ b/testing/test_remote.py @@ -121,6 +121,23 @@ if rep.failed: assert newrep.longrepr == str(rep.longrepr) + def test_extended_report_deserialization(self, testdir): + reprec = testdir.inline_runsource("qwe abc") + reports = reprec.getreports("pytest_collectreport") + assert reports + for rep in reports: + rep.extra = True + d = serialize_report(rep) + check_marshallable(d) + newrep = unserialize_report("collectreport", d) + assert newrep.extra + assert newrep.passed == rep.passed + assert newrep.failed == rep.failed + assert newrep.skipped == rep.skipped + if rep.failed: + assert newrep.longrepr == str(rep.longrepr) + + class TestSlaveInteractor: def test_basic_collect_and_runtests(self, slave): p = slave.testdir.makepyfile(""" Repository URL: https://bitbucket.org/hpk42/pytest-xdist/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Mon Jan 23 15:40:38 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Mon, 23 Jan 2012 14:40:38 -0000 Subject: [py-svn] commit/pytest-codecheckers: RonnyPfannschmidt: fix tests and code Message-ID: <20120123144038.10645.4646@bitbucket05.managed.contegix.com> 1 new commit in pytest-codecheckers: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/changeset/d6c8e1d69203/ changeset: d6c8e1d69203 user: RonnyPfannschmidt date: 2012-01-23 15:40:28 summary: fix tests and code affected #: 2 files diff -r 35e51c4a7984854221ba2961968c984023ddd904 -r d6c8e1d69203d17b231164b8b2923c9b79a044ba codecheckers/plugin.py --- a/codecheckers/plugin.py +++ b/codecheckers/plugin.py @@ -40,8 +40,9 @@ return [] checkers = self.config.getini('codechecks') entrypoints = pkg_resources.iter_entry_points('codechecker') - #XXX: list wanted checkers we didnt get - return [PyCodeCheckItem(ep, self) for ep in entrypoints if ep.name in checkers] + + items = [PyCodeCheckItem(ep, self) for ep in entrypoints if ep.name in checkers] + return items def pytest_collect_file(path, parent): diff -r 35e51c4a7984854221ba2961968c984023ddd904 -r d6c8e1d69203d17b231164b8b2923c9b79a044ba tests/test_pyflakes.py --- a/tests/test_pyflakes.py +++ b/tests/test_pyflakes.py @@ -1,25 +1,30 @@ +def pytest_funcarg__testdir(request): + testdir = request.getfuncargvalue('testdir') + testdir.makeini('[pytest]\ncodechecks = pyflakes') + return testdir + + def test_pyflakes_finds_name_error(testdir): - f = testdir.makepyfile(''' + testdir.makepyfile(''' def tesdt_a(): pass def b(): abc ''') #XXX: bad hack cause i fail to disable the pep8 checker - f.write(f.read() + '\n') - out = testdir.runpytest('--tb=short', '--codecheck=pyflakes', '-k', 'flakes', '-v') + out = testdir.runpytest('--tb=short', '-k', 'flakes', '-v') out.stdout.fnmatch_lines([ '*abc*', '*1 failed*', ]) + def test_reportinfo_verbose(testdir): - f = testdir.makepyfile(''' + testdir.makepyfile(''' def xyz(): pass ''') - f.write(f.read() + '\n') - out = testdir.runpytest('-v', '--codecheck=pyflakes') + out = testdir.runpytest('-v') out.stdout.fnmatch_lines([ - '*test_reportinfo_verbose.py: codecheck pyflakes PASSED', + '*test_reportinfo_verbose.py:0: codecheck pyflakes PASSED', ]) Repository URL: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. From commits-noreply at bitbucket.org Mon Jan 23 15:42:23 2012 From: commits-noreply at bitbucket.org (Bitbucket) Date: Mon, 23 Jan 2012 14:42:23 -0000 Subject: [py-svn] commit/pytest-codecheckers: RonnyPfannschmidt: require more recent pytest Message-ID: <20120123144223.29076.22536@bitbucket01.managed.contegix.com> 1 new commit in pytest-codecheckers: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/changeset/0cfda7d80702/ changeset: 0cfda7d80702 user: RonnyPfannschmidt date: 2012-01-23 15:42:08 summary: require more recent pytest affected #: 1 file diff -r d6c8e1d69203d17b231164b8b2923c9b79a044ba -r 0cfda7d80702cc34b623709a5384de56461e7783 setup.py --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ ], }, install_requires=[ - 'pytest', + 'pytest>=2.0', 'pyflakes>=0.4', 'pep8', ], Repository URL: https://bitbucket.org/RonnyPfannschmidt/pytest-codecheckers/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.