From 1930f50bc2030eb940798ca4ae8837ab0da839a9 Mon Sep 17 00:00:00 2001 From: hpk Date: Wed, 25 Mar 2009 12:50:57 +0100 Subject: [PATCH] [svn r63319] * fixing verbose reporting to work the "old" way for non-dist settings * bump version number * comment out greenlet C-Extension for now --HG-- branch : trunk --- py/__init__.py | 6 ++--- py/test/plugin/pytest_plugintester.py | 22 +++------------- py/test/plugin/pytest_terminal.py | 36 ++++++++++++++++----------- py/test/testing/acceptance_test.py | 11 +++++--- setup.py | 13 ++++++---- 5 files changed, 43 insertions(+), 45 deletions(-) diff --git a/py/__init__.py b/py/__init__.py index a459a5aca..fffcdab61 100644 --- a/py/__init__.py +++ b/py/__init__.py @@ -23,12 +23,12 @@ http://pylib.org/contact.html """ from initpkg import initpkg -version = "1.0.0a6" +version = "1.0.0a7" initpkg(__name__, description = "pylib and py.test: agile development and test support library", - revision = int('$LastChangedRevision: 63241 $'.split(':')[1][:-1]), - lastchangedate = '$LastChangedDate: 2009-03-23 17:03:10 +0100 (Mon, 23 Mar 2009) $', + revision = int('$LastChangedRevision: 63319 $'.split(':')[1][:-1]), + lastchangedate = '$LastChangedDate: 2009-03-25 12:50:57 +0100 (Wed, 25 Mar 2009) $', version = version, url = "http://pylib.org", download_url = "http://codespeak.net/py/%s/download.html" % version, diff --git a/py/test/plugin/pytest_plugintester.py b/py/test/plugin/pytest_plugintester.py index 227718803..fba4ca298 100644 --- a/py/test/plugin/pytest_plugintester.py +++ b/py/test/plugin/pytest_plugintester.py @@ -108,16 +108,6 @@ class PytestPluginHooks: """ called before test process is exited. """ - def pytest_event(self, event): - """ called for each internal py.test event. """ - - #def pytest_pyfuncarg_NAME(self, pyfuncitem, argname): - # """ provide (value, finalizer) for an open test function argument. - # - # the finalizer (if not None) will be called after the test - # function has been executed (i.e. pyfuncitem.execute() returns). - # """ - def pytest_pyfunc_call(self, pyfuncitem, args, kwargs): """ return True if we consumed/did the call to the python function item. """ @@ -139,24 +129,19 @@ class PytestPluginHooks: def pytest_pymodule_makeitem(self, modcol, name, obj): """ return custom item/collector for a python object in a module, or None. """ - - # from pytest_terminal plugin - def pytest_report_teststatus(self, event): - """ return shortletter and verbose word. """ - - # from pytest_terminal plugin + # reporting hooks (invoked from pytest_terminal.py) def pytest_report_teststatus(self, event): """ return shortletter and verbose word. """ def pytest_terminal_summary(self, terminalreporter): """ add additional section in terminal summary reporting. """ - # events + # Events def pyevent(self, eventname, *args, **kwargs): """ called for each testing event. """ def pyevent_gateway_init(self, gateway): - """ called a gateway has been initialized. """ + """ called after a gateway has been initialized. """ def pyevent_gateway_exit(self, gateway): """ called when gateway is being exited. """ @@ -199,7 +184,6 @@ class PytestPluginHooks: The gateway will have an 'id' attribute that is unique within the gateway manager context. """ - def pyevent_testnodeready(self, node): """ Node is ready to operate. """ diff --git a/py/test/plugin/pytest_terminal.py b/py/test/plugin/pytest_terminal.py index c74689758..aedef4664 100644 --- a/py/test/plugin/pytest_terminal.py +++ b/py/test/plugin/pytest_terminal.py @@ -143,11 +143,15 @@ class TerminalReporter: if node: extra = "-> " + str(node.gateway.id) self.write_ensure_prefix(line, extra) - #else: - # # ensure that the path is printed before the 1st test of - # # a module starts running - # fspath = item.fspath - # self.write_fspath_result(fspath, "") + # in dist situations itemstart (currently only means we + # queued the item for testing, doesn't tell much + elif self.config.option.verbose and self.config.option.dist == "no": + # ensure that the path is printed before the 1st test of + # a module starts running + info = item.repr_metainfo() + line = info.verboseline(basedir=self.curdir) + " " + #self.write_fspath_result(fspath, "") + self.write_ensure_prefix(line, "") def pyevent_rescheduleitems(self, event): if self.config.option.debug: @@ -169,13 +173,15 @@ class TerminalReporter: else: info = event.colitem.repr_metainfo() line = info.verboseline(basedir=self.curdir) + " " - #self.write_ensure_prefix(line, word, **markup) - self.ensure_newline() - if hasattr(event, 'node'): - self._tw.write("%s " % event.node.gateway.id) - self._tw.write(word, **markup) - self._tw.write(" " + line) - self.currentfspath = -2 + if not hasattr(event, 'node'): + self.write_ensure_prefix(line, word, **markup) + else: + self.ensure_newline() + if hasattr(event, 'node'): + self._tw.write("%s " % event.node.gateway.id) + self._tw.write(word, **markup) + self._tw.write(" " + line) + self.currentfspath = -2 def pyevent_collectionreport(self, event): if not event.passed: @@ -400,9 +406,9 @@ class TestTerminal: rep.config.bus.notify("itemtestreport", basic_run_report(item)) linecomp.assert_contains_lines([ - "*PASS*test_pass_skip_fail_verbose.py:2: *test_ok*", - "*SKIP*test_pass_skip_fail_verbose.py:4: *test_skip*", - "*FAIL*test_pass_skip_fail_verbose.py:6: *test_func*", + "*test_pass_skip_fail_verbose.py:2: *test_ok*PASS*", + "*test_pass_skip_fail_verbose.py:4: *test_skip*SKIP*", + "*test_pass_skip_fail_verbose.py:6: *test_func*FAIL*", ]) rep.config.bus.notify("testrunfinish", event.TestrunFinish()) linecomp.assert_contains_lines([ diff --git a/py/test/testing/acceptance_test.py b/py/test/testing/acceptance_test.py index 93e1e23a6..8539f395a 100644 --- a/py/test/testing/acceptance_test.py +++ b/py/test/testing/acceptance_test.py @@ -267,11 +267,16 @@ class TestGeneralUsage: yield check, 0 """) result = testdir.runpytest(p1, '-v') + result.stdout.fnmatch_lines([ + "*test_verbose_reporting.py:2: test_fail*FAIL*", + "*test_verbose_reporting.py:4: test_pass*PASS*", + "*test_verbose_reporting.py:7: TestClass.test_skip*SKIP*", + "*test_verbose_reporting.py:10: test_gen*FAIL*", + ]) + assert result.ret == 1 + result = testdir.runpytest(p1, '-v', '-n 1') result.stdout.fnmatch_lines([ "*FAIL*test_verbose_reporting.py:2: test_fail*", - "*PASS*test_verbose_reporting.py:4: test_pass*", - "*SKIP*test_verbose_reporting.py:7: TestClass.test_skip*", - "*FAIL*test_verbose_reporting.py:10: test_gen*", ]) assert result.ret == 1 diff --git a/setup.py b/setup.py index 1279df062..9b92be27e 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ """ setup file for 'py' package based on: - https://codespeak.net/svn/py/trunk, revision=63240 + https://codespeak.net/svn/py/trunk, revision=63254 autogenerated by gensetup.py """ @@ -34,20 +34,23 @@ http://pylib.org/contact.html """ +CEXTENSION = False def main(): setup( name='py', description='pylib and py.test: agile development and test support library', long_description = long_description, - version='1.0.0a6', + version='1.0.0a7', url='http://pylib.org', - download_url='http://codespeak.net/py/1.0.0a6/download.html', + download_url='http://codespeak.net/py/1.0.0a7/download.html', license='MIT license', platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'], author='holger krekel, Guido Wesdorp, Carl Friedrich Bolz, Armin Rigo, Maciej Fijalkowski & others', author_email='holger at merlinux.eu, py-dev at codespeak.net', - ext_modules = [Extension("py.c-extension.greenlet.greenlet", - ["py/c-extension/greenlet/greenlet.c"]),], + ext_modules = CEXTENSION and + [Extension("py.c-extension.greenlet.greenlet", + ["py/c-extension/greenlet/greenlet.c"]),] + or [], entry_points={'console_scripts': ['py.cleanup = py.cmdline:pycleanup', 'py.countloc = py.cmdline:pycountloc',