2 new commits in pytest:
https://bitbucket.org/hpk42/pytest/changeset/b39424a4326a/ changeset: b39424a4326a user: hpk42 date: 2012-10-17 11:50:32 summary: remove unused code affected #: 1 file diff -r b2aa891c2fcf1dcfe5dcf833df00d76e2b645765 -r b39424a4326a04c6c20ae2bf25e578e703599fd6 _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -53,21 +53,6 @@ defaultfuncargprefixmarker = fixture() -def cached_property(f): - """returns a cached property that is calculated by function f. - taken from http://code.activestate.com/recipes/576563-cached-property/""" - def get(self): - try: - return self._property_cache[f] - except AttributeError: - self._property_cache = {} - x = self._property_cache[f] = f(self) - return x - except KeyError: - x = self._property_cache[f] = f(self) - return x - return property(get) - def pyobj_property(name): def get(self): node = self.getparent(getattr(pytest, name)) https://bitbucket.org/hpk42/pytest/changeset/29f960b2322f/ changeset: 29f960b2322f user: hpk42 date: 2012-10-17 12:57:05 summary: improve --fixtures output with per-plugin grouping and hiding underscore names in non-verbose mode, re-introduce --funcargs for compatibiliy affected #: 4 files diff -r b39424a4326a04c6c20ae2bf25e578e703599fd6 -r 29f960b2322f533da940d72265adc8b0de5dc27c _pytest/__init__.py --- a/_pytest/__init__.py +++ b/_pytest/__init__.py @@ -1,2 +1,2 @@ # -__version__ = '2.3.0.dev25' +__version__ = '2.3.0.dev26' diff -r b39424a4326a04c6c20ae2bf25e578e703599fd6 -r 29f960b2322f533da940d72265adc8b0de5dc27c _pytest/python.py --- a/_pytest/python.py +++ b/_pytest/python.py @@ -65,7 +65,7 @@ def pytest_addoption(parser): group = parser.getgroup("general") - group.addoption('--fixtures', '--fixtures', + group.addoption('--fixtures', '--funcargs', action="store_true", dest="showfixtures", default=False, help="show available fixtures, sorted by plugin appearance") parser.addini("usefixtures", type="args", default=[], @@ -746,15 +746,24 @@ fixturedef = fixturedefs[-1] loc = getlocation(fixturedef.func, curdir) available.append((len(fixturedef.baseid), + fixturedef.func.__module__, curdir.bestrelpath(loc), fixturedef.argname, fixturedef)) available.sort() - for baseid, bestrel, argname, fixturedef in available: + currentmodule = None + for baseid, module, bestrel, argname, fixturedef in available: + if currentmodule != module: + if not module.startswith("_pytest."): + tw.line() + tw.sep("-", "fixtures defined from %s" %(module,)) + currentmodule = module + if verbose <= 0 and argname[0] == "_": + continue if verbose > 0: - funcargspec = "%s -- %s" %(name, loc,) + funcargspec = "%s -- %s" %(argname, loc,) else: - funcargspec = argname # "%s %s" %(baseid, argname) + funcargspec = argname tw.line(funcargspec, green=True) loc = getlocation(fixturedef.func, curdir) doc = fixturedef.func.__doc__ or "" diff -r b39424a4326a04c6c20ae2bf25e578e703599fd6 -r 29f960b2322f533da940d72265adc8b0de5dc27c 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.3.0.dev25', + version='2.3.0.dev26', url='http://pytest.org', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], diff -r b39424a4326a04c6c20ae2bf25e578e703599fd6 -r 29f960b2322f533da940d72265adc8b0de5dc27c testing/test_python.py --- a/testing/test_python.py +++ b/testing/test_python.py @@ -1575,6 +1575,10 @@ """ class TestShowFixtures: + def test_funcarg_compat(self, testdir): + config = testdir.parseconfigure("--funcargs") + assert config.option.showfixtures + def test_show_fixtures(self, testdir): result = testdir.runpytest("--fixtures") result.stdout.fnmatch_lines([ @@ -1583,19 +1587,32 @@ ] ) + def test_show_fixtures_verbose(self, testdir): + result = testdir.runpytest("--fixtures", "-v") + result.stdout.fnmatch_lines([ + "*tmpdir*", + "*temporary directory*", + ] + ) + def test_show_fixtures_testmodule(self, testdir): p = testdir.makepyfile(''' import pytest @pytest.fixture + def _arg0(): + """ hidden """ + @pytest.fixture def arg1(): """ hello world """ ''') result = testdir.runpytest("--fixtures", p) result.stdout.fnmatch_lines(""" - *tmpdir* + *tmpdir + *fixtures defined from* *arg1* *hello world* """) + assert "arg0" not in result.stdout.str() @pytest.mark.parametrize("testmod", [True, False]) def test_show_fixtures_conftest(self, testdir, testmod): @@ -1613,6 +1630,7 @@ result = testdir.runpytest("--fixtures") result.stdout.fnmatch_lines(""" *tmpdir* + *fixtures defined from*conftest* *arg1* *hello world* """) 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. _______________________________________________ py-svn mailing list py-svn@codespeak.net http://codespeak.net/mailman/listinfo/py-svn