pytest-instafail-0.1.0/0000755000076500000240000000000012130363663015231 5ustar jannestaff00000000000000pytest-instafail-0.1.0/CHANGES.rst0000644000076500000240000000025512130362675017037 0ustar jannestaff00000000000000Changelog --------- Here you can see the full list of changes between each pytest-instafail release. 0.1.0 (April 8, 2013) ^^^^^^^^^^^^^^^^^^^^^ - Initial public release pytest-instafail-0.1.0/LICENSE0000644000076500000240000000263112130326012016223 0ustar jannestaff00000000000000Copyright (c) 2013, Janne Vanhala All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * The names of the contributors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. pytest-instafail-0.1.0/MANIFEST.in0000644000076500000240000000014212130362557016765 0ustar jannestaff00000000000000include CHANGES.rst include README.rst include setup.py include LICENSE include test_instafail.py pytest-instafail-0.1.0/PKG-INFO0000644000076500000240000000414612130363663016333 0ustar jannestaff00000000000000Metadata-Version: 1.1 Name: pytest-instafail Version: 0.1.0 Summary: py.test plugin to show failures instantly Home-page: https://github.com/jpvanhal/pytest-instafail Author: Janne Vanhala Author-email: janne.vanhala@gmail.com License: BSD Description: pytest-instafail ================ |build status|_ .. |build status| image:: https://secure.travis-ci.org/jpvanhal/pytest-instafail.png?branch=master :alt: Build Status .. _build status: http://travis-ci.org/jpvanhal/pytest-instafail pytest-instafail is a plugin for `py.test `_ that shows failures and errors instantly instead of waiting until the end of test session. Installation ------------ To install pytest-instafail:: $ pip install pytest-instafail Then run your tests with:: $ py.test --instafail Resources --------- - `Issue Tracker `_ - `Code `_ - `Development Version `_ Platform: any Classifier: Development Status :: 3 - Alpha Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: POSIX Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: MacOS :: MacOS X Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Utilities Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.5 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: Implementation :: PyPy pytest-instafail-0.1.0/pytest_instafail.egg-info/0000755000076500000240000000000012130363663022305 5ustar jannestaff00000000000000pytest-instafail-0.1.0/pytest_instafail.egg-info/dependency_links.txt0000644000076500000240000000000112130363663026353 0ustar jannestaff00000000000000 pytest-instafail-0.1.0/pytest_instafail.egg-info/entry_points.txt0000644000076500000240000000005112130363663025577 0ustar jannestaff00000000000000[pytest11] instafail = pytest_instafail pytest-instafail-0.1.0/pytest_instafail.egg-info/not-zip-safe0000644000076500000240000000000112130326314024523 0ustar jannestaff00000000000000 pytest-instafail-0.1.0/pytest_instafail.egg-info/PKG-INFO0000644000076500000240000000414612130363663023407 0ustar jannestaff00000000000000Metadata-Version: 1.1 Name: pytest-instafail Version: 0.1.0 Summary: py.test plugin to show failures instantly Home-page: https://github.com/jpvanhal/pytest-instafail Author: Janne Vanhala Author-email: janne.vanhala@gmail.com License: BSD Description: pytest-instafail ================ |build status|_ .. |build status| image:: https://secure.travis-ci.org/jpvanhal/pytest-instafail.png?branch=master :alt: Build Status .. _build status: http://travis-ci.org/jpvanhal/pytest-instafail pytest-instafail is a plugin for `py.test `_ that shows failures and errors instantly instead of waiting until the end of test session. Installation ------------ To install pytest-instafail:: $ pip install pytest-instafail Then run your tests with:: $ py.test --instafail Resources --------- - `Issue Tracker `_ - `Code `_ - `Development Version `_ Platform: any Classifier: Development Status :: 3 - Alpha Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: BSD License Classifier: Operating System :: POSIX Classifier: Operating System :: Microsoft :: Windows Classifier: Operating System :: MacOS :: MacOS X Classifier: Topic :: Software Development :: Testing Classifier: Topic :: Software Development :: Libraries Classifier: Topic :: Utilities Classifier: Programming Language :: Python :: 2 Classifier: Programming Language :: Python :: 2.5 Classifier: Programming Language :: Python :: 2.6 Classifier: Programming Language :: Python :: 2.7 Classifier: Programming Language :: Python :: 3 Classifier: Programming Language :: Python :: 3.2 Classifier: Programming Language :: Python :: 3.3 Classifier: Programming Language :: Python :: Implementation :: PyPy pytest-instafail-0.1.0/pytest_instafail.egg-info/requires.txt0000644000076500000240000000001312130363663024677 0ustar jannestaff00000000000000pytest>=2.3pytest-instafail-0.1.0/pytest_instafail.egg-info/SOURCES.txt0000644000076500000240000000056212130363663024174 0ustar jannestaff00000000000000CHANGES.rst LICENSE MANIFEST.in README.rst pytest_instafail.py setup.py test_instafail.py pytest_instafail.egg-info/PKG-INFO pytest_instafail.egg-info/SOURCES.txt pytest_instafail.egg-info/dependency_links.txt pytest_instafail.egg-info/entry_points.txt pytest_instafail.egg-info/not-zip-safe pytest_instafail.egg-info/requires.txt pytest_instafail.egg-info/top_level.txtpytest-instafail-0.1.0/pytest_instafail.egg-info/top_level.txt0000644000076500000240000000002112130363663025030 0ustar jannestaff00000000000000pytest_instafail pytest-instafail-0.1.0/pytest_instafail.py0000644000076500000240000000557412130362267021177 0ustar jannestaff00000000000000# -*- coding: utf-8 -*- """ pytest_instafail ~~~~~~~~~~~~~~~~ py.test plugin to show failures instantly. :copyright: (c) 2013 by Janne Vanhala. :license: BSD, see LICENSE for more details. """ import pytest from _pytest.terminal import TerminalReporter def pytest_addoption(parser): group = parser.getgroup("terminal reporting", "reporting", after="general") group._addoption( '--instafail', action="store_true", dest="instafail", default=False, help=( "show failures and errors instantly as they occur (disabled by " "default)." ) ) @pytest.mark.trylast def pytest_configure(config): if config.option.instafail: # Get the standard terminal reporter plugin... standard_reporter = config.pluginmanager.getplugin('terminalreporter') instafail_reporter = InstafailingTerminalReporter(standard_reporter) # ...and replace it with our own instafailing reporter. config.pluginmanager.unregister(standard_reporter) config.pluginmanager.register(instafail_reporter, 'terminalreporter') class InstafailingTerminalReporter(TerminalReporter): def __init__(self, reporter): TerminalReporter.__init__(self, reporter.config) self._tw = reporter._tw def pytest_collectreport(self, report): # Show errors occurred during the collection instantly. TerminalReporter.pytest_collectreport(self, report) if report.failed: self.rewrite("") # erase the "collecting" message self.print_failure(report) def pytest_runtest_logreport(self, report): # Show failures and errors occuring during running a test # instantly. TerminalReporter.pytest_runtest_logreport(self, report) if report.failed: if self.verbosity <= 0: self._tw.line() self.print_failure(report) def summary_failures(self): # Prevent failure summary from being shown since we already # show the failure instantly after failure has occured. pass def summary_errors(self): # Prevent error summary from being shown since we already # show the error instantly after error has occured. pass def print_failure(self, report): if self.config.option.tbstyle != "no": if self.config.option.tbstyle == "line": line = self._getcrashline(report) self.write_line(line) else: msg = self._getfailureheadline(report) if not hasattr(report, 'when'): msg = "ERROR collecting " + msg elif report.when == "setup": msg = "ERROR at setup of " + msg elif report.when == "teardown": msg = "ERROR at teardown of " + msg self.write_sep("_", msg) self._outrep_summary(report) pytest-instafail-0.1.0/README.rst0000644000076500000240000000145112130350042016704 0ustar jannestaff00000000000000pytest-instafail ================ |build status|_ .. |build status| image:: https://secure.travis-ci.org/jpvanhal/pytest-instafail.png?branch=master :alt: Build Status .. _build status: http://travis-ci.org/jpvanhal/pytest-instafail pytest-instafail is a plugin for `py.test `_ that shows failures and errors instantly instead of waiting until the end of test session. Installation ------------ To install pytest-instafail:: $ pip install pytest-instafail Then run your tests with:: $ py.test --instafail Resources --------- - `Issue Tracker `_ - `Code `_ - `Development Version `_ pytest-instafail-0.1.0/setup.cfg0000644000076500000240000000007312130363663017052 0ustar jannestaff00000000000000[egg_info] tag_build = tag_date = 0 tag_svn_revision = 0 pytest-instafail-0.1.0/setup.py0000644000076500000240000000256512130346776016761 0ustar jannestaff00000000000000from setuptools import setup setup( name='pytest-instafail', description='py.test plugin to show failures instantly', long_description=open("README.rst").read(), version='0.1.0', url='https://github.com/jpvanhal/pytest-instafail', license='BSD', author='Janne Vanhala', author_email='janne.vanhala@gmail.com', py_modules=['pytest_instafail'], entry_points={'pytest11': ['instafail = pytest_instafail']}, zip_safe=False, include_package_data=True, platforms='any', install_requires=['pytest>=2.3'], classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'License :: OSI Approved :: BSD License', 'Operating System :: POSIX', 'Operating System :: Microsoft :: Windows', 'Operating System :: MacOS :: MacOS X', 'Topic :: Software Development :: Testing', 'Topic :: Software Development :: Libraries', 'Topic :: Utilities', 'Programming Language :: Python :: 2', 'Programming Language :: Python :: 2.5', 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: Implementation :: PyPy', ] ) pytest-instafail-0.1.0/test_instafail.py0000644000076500000240000001704612130361432020614 0ustar jannestaff00000000000000# -*- coding: utf-8 -*- pytest_plugins = "pytester" class Option(object): def __init__(self, verbose=False, quiet=False): self.verbose = verbose self.quiet = quiet @property def args(self): l = ['--instafail'] if self.verbose: l.append('-v') if self.quiet: l.append('-q') return l def pytest_generate_tests(metafunc): if "option" in metafunc.fixturenames: metafunc.addcall(id="default", funcargs={'option': Option(verbose=False)}) metafunc.addcall(id="verbose", funcargs={'option': Option(verbose=True)}) metafunc.addcall(id="quiet", funcargs={'option': Option(quiet=True)}) class TestInstafailingTerminalReporter(object): def test_fail(self, testdir, option): testdir.makepyfile( """ import pytest def test_func(): assert 0 """ ) result = testdir.runpytest(*option.args) if option.verbose: result.stdout.fnmatch_lines([ "*test_fail.py:2: *test_func*FAIL*", "* test_func *", " def test_func():", "> assert 0", "E assert 0", ]) elif option.quiet: result.stdout.fnmatch_lines([ "F", "* test_func *", " def test_func():", "> assert 0", "E assert 0", ]) else: result.stdout.fnmatch_lines([ "*test_fail.py F", "* test_func *", " def test_func():", "> assert 0", "E assert 0", ]) def test_fail_fail(self, testdir, option): testdir.makepyfile( """ import pytest def test_func(): assert 0 def test_func2(): assert 0 """ ) result = testdir.runpytest(*option.args) if option.verbose: result.stdout.fnmatch_lines([ "*test_fail_fail.py:2: *test_func*FAIL*", "* test_func *", " def test_func():", "> assert 0", "E assert 0", "test_fail_fail.py:3: AssertionError", "", "*test_fail_fail.py:4: *test_func2*FAIL*", "* test_func2 *", " def test_func2():", "> assert 0", "E assert 0", ]) elif option.quiet: result.stdout.fnmatch_lines([ "F", "* test_func *", " def test_func():", "> assert 0", "E assert 0", "F", "* test_func2 *", " def test_func2():", "> assert 0", "E assert 0", ]) else: result.stdout.fnmatch_lines([ "*test_fail_fail.py F", "* test_func *", " def test_func():", "> assert 0", "E assert 0", "*test_fail_fail.py F", "* test_func2 *", " def test_func2():", "> assert 0", "E assert 0", ]) def test_error_in_setup_then_pass(self, testdir, option): testdir.makepyfile( """ def setup_function(function): print ("setup func") if function is test_nada: assert 0 def test_nada(): pass def test_zip(): pass """ ) result = testdir.runpytest(*option.args) if option.verbose: result.stdout.fnmatch_lines([ "*test_error_in_setup_then_pass.py:5: *test_nada*ERROR*", "*ERROR at setup of test_nada*", "*setup_function(function):*", "*setup func*", "*assert 0*", "test_error_in_setup_then_pass.py:4: AssertionError", "", "*test_error_in_setup_then_pass.py:7: *test_zip*PASSED*", "*1 error*", ]) elif option.quiet: result.stdout.fnmatch_lines([ "E", "*ERROR at setup of test_nada*", "*setup_function(function):*", "*setup func*", "*assert 0*", "test_error_in_setup_then_pass.py:4: AssertionError", ".", ]) else: result.stdout.fnmatch_lines([ "*test_error_in_setup_then_pass.py E", "*ERROR at setup of test_nada*", "*setup_function(function):*", "*setup func*", "*assert 0*", "test_error_in_setup_then_pass.py:4: AssertionError", "", "*test_error_in_setup_then_pass.py .", "*1 error*", ]) assert result.ret != 0 def test_error_in_teardown_then_pass(self, testdir, option): testdir.makepyfile( """ def teardown_function(function): print ("teardown func") if function is test_nada: assert 0 def test_nada(): pass def test_zip(): pass """ ) result = testdir.runpytest(*option.args) if option.verbose: result.stdout.fnmatch_lines([ "*test_error_in_teardown_then_pass.py:5: *test_nada*ERROR*", "*ERROR at teardown of test_nada*", "*teardown_function(function):*", "*teardown func*", "*assert 0*", "test_error_in_teardown_then_pass.py:4: AssertionError", "", "*test_error_in_teardown_then_pass.py:7: *test_zip*PASSED*", "*1 error*", ]) elif option.quiet: result.stdout.fnmatch_lines([ ".E", "*ERROR at teardown of test_nada*", "*teardown_function(function):*", "*teardown func*", "*assert 0*", "test_error_in_teardown_then_pass.py:4: AssertionError", ".", ]) else: result.stdout.fnmatch_lines([ "*test_error_in_teardown_then_pass.py .E", "*ERROR at teardown of test_nada*", "*teardown_function(function):*", "*teardown func*", "*assert 0*", "test_error_in_teardown_then_pass.py:4: AssertionError", "", "*test_error_in_teardown_then_pass.py .", "*1 error*", ]) assert result.ret != 0 def test_collect_error(self, testdir, option): testdir.makepyfile("""raise ValueError(0)""") result = testdir.runpytest(*option.args) result.stdout.fnmatch_lines([ "*ERROR collecting test_collect_error.py*", "test_collect_error.py:1: in ", "> raise ValueError(0)", "E ValueError: 0", ]) if not option.quiet: result.stdout.fnmatch_lines([ "collected 0 items / 1 errors", ])