././@PaxHeader0000000000000000000000000000003300000000000010211 xustar0027 mtime=1680282935.078389 pytest-instafail-0.5.0/0000755000076500000240000000000014411612467014040 5ustar00jannestaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282453.0 pytest-instafail-0.5.0/CHANGES.rst0000644000076500000240000000316314411611525015637 0ustar00jannestaffChangelog --------- Here you can see the full list of changes between each pytest-instafail release. 0.5.0 (March 31, 2023) ^^^^^^^^^^^^^^^^^^^^^^ - Use ``pytest.hookimpl`` to configure hooks, avoiding a deprecation warning in pytest 7.2.0. - Dropped support for Python 3.6. - Added support for Python 3.11. 0.4.2 (June 14, 2020) ^^^^^^^^^^^^^^^^^^^^^ - Fixed usage of deprecated pytest-xdist slave aliases (#20). - Fixed failing tests on pytest 5 0.4.1 (February 15, 2019) ^^^^^^^^^^^^^^^^^^^^^^^^^ - Fixed compatibility with pytest 4.2.0. Thanks @blueyed for the PR. 0.4.0 (May 19, 2018) ^^^^^^^^^^^^^^^^^^^^ - Added support for Python 3.5, 3.6, and 3.7. - Dropped support for Python 2.7, 3.2, and 3.3. - Dropped support for pytest < 2.9. - Only rewrite lines on tty. Previously you would end up with a \r (^M) in case collecting of tests failed, and pytest's output is piped to a file. Thanks @blueyed for the PR. - Support -p no:terminal (#12). Thanks @Maratori for the PR. 0.3.0 (August 30, 2014) ^^^^^^^^^^^^^^^^^^^^^^^ - Added support for Python 3.4 - Added support for pytest 2.6 - Fixed failing tests on pytest 2.6 0.2.0 (March 6, 2014) ^^^^^^^^^^^^^^^^^^^^^ - Dropped support for Python 2.5. - Fixed stacktrace printed twice when using PDB. - Fixed internal error when a test marked as xfailing unexpectedly passes (David Szotten). 0.1.1 (November 9, 2013) ^^^^^^^^^^^^^^^^^^^^^^^^ - Made pytest-instafail compatible with `pytest-xdist`_'s test parallelization (Ronny Pfannschmidt). 0.1.0 (April 8, 2013) ^^^^^^^^^^^^^^^^^^^^^ - Initial public release .. _`pytest-xdist`: http://pypi.python.org/pypi/pytest-xdist ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282285.0 pytest-instafail-0.5.0/LICENSE0000644000076500000240000000263614411611255015046 0ustar00jannestaffCopyright (c) 2013-2016, 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. ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282285.0 pytest-instafail-0.5.0/MANIFEST.in0000644000076500000240000000014214411611255015565 0ustar00jannestaffinclude CHANGES.rst include README.rst include setup.py include LICENSE include test_instafail.py ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1680282935.0784533 pytest-instafail-0.5.0/PKG-INFO0000644000076500000240000000414014411612467015134 0ustar00jannestaffMetadata-Version: 2.1 Name: pytest-instafail Version: 0.5.0 Summary: pytest plugin to show failures instantly Home-page: https://github.com/pytest-dev/pytest-instafail Author: Janne Vanhala Author-email: janne.vanhala@gmail.com License: BSD Platform: any Classifier: Development Status :: 4 - Beta 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 :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.7 License-File: LICENSE pytest-instafail ================ |build status|_ .. |build status| image:: https://github.com/pytest-dev/pytest-instafail/actions/workflows/test.yml/badge.svg :alt: Build Status .. _build status: https://github.com/pytest-dev/pytest-instafail/actions/workflows/test.yml pytest-instafail is a plugin for `pytest `_ that shows failures and errors instantly instead of waiting until the end of test session. Requirements ------------ You will need the following prerequisites in order to use pytest-instafail: - Python 3.7+ or PyPy3 - pytest 5 or newer Installation ------------ To install pytest-instafail:: $ pip install pytest-instafail Then run your tests with:: $ pytest --instafail Resources --------- - `Issue Tracker `_ - `Code `_ - `Development Version `_ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282285.0 pytest-instafail-0.5.0/README.rst0000644000076500000240000000175114411611255015525 0ustar00jannestaffpytest-instafail ================ |build status|_ .. |build status| image:: https://github.com/pytest-dev/pytest-instafail/actions/workflows/test.yml/badge.svg :alt: Build Status .. _build status: https://github.com/pytest-dev/pytest-instafail/actions/workflows/test.yml pytest-instafail is a plugin for `pytest `_ that shows failures and errors instantly instead of waiting until the end of test session. Requirements ------------ You will need the following prerequisites in order to use pytest-instafail: - Python 3.7+ or PyPy3 - pytest 5 or newer Installation ------------ To install pytest-instafail:: $ pip install pytest-instafail Then run your tests with:: $ pytest --instafail Resources --------- - `Issue Tracker `_ - `Code `_ - `Development Version `_ ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1680282935.0782588 pytest-instafail-0.5.0/pytest_instafail.egg-info/0000755000076500000240000000000014411612467021114 5ustar00jannestaff././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282935.0 pytest-instafail-0.5.0/pytest_instafail.egg-info/PKG-INFO0000644000076500000240000000414014411612467022210 0ustar00jannestaffMetadata-Version: 2.1 Name: pytest-instafail Version: 0.5.0 Summary: pytest plugin to show failures instantly Home-page: https://github.com/pytest-dev/pytest-instafail Author: Janne Vanhala Author-email: janne.vanhala@gmail.com License: BSD Platform: any Classifier: Development Status :: 4 - Beta 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 :: 3 Classifier: Programming Language :: Python :: 3 :: Only Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Programming Language :: Python :: 3.9 Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: Implementation :: PyPy Requires-Python: >=3.7 License-File: LICENSE pytest-instafail ================ |build status|_ .. |build status| image:: https://github.com/pytest-dev/pytest-instafail/actions/workflows/test.yml/badge.svg :alt: Build Status .. _build status: https://github.com/pytest-dev/pytest-instafail/actions/workflows/test.yml pytest-instafail is a plugin for `pytest `_ that shows failures and errors instantly instead of waiting until the end of test session. Requirements ------------ You will need the following prerequisites in order to use pytest-instafail: - Python 3.7+ or PyPy3 - pytest 5 or newer Installation ------------ To install pytest-instafail:: $ pip install pytest-instafail Then run your tests with:: $ pytest --instafail Resources --------- - `Issue Tracker `_ - `Code `_ - `Development Version `_ ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282935.0 pytest-instafail-0.5.0/pytest_instafail.egg-info/SOURCES.txt0000644000076500000240000000057414411612467023006 0ustar00jannestaffCHANGES.rst LICENSE MANIFEST.in README.rst pytest_instafail.py setup.cfg 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.txt././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282935.0 pytest-instafail-0.5.0/pytest_instafail.egg-info/dependency_links.txt0000644000076500000240000000000114411612467025162 0ustar00jannestaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282935.0 pytest-instafail-0.5.0/pytest_instafail.egg-info/entry_points.txt0000644000076500000240000000005014411612467024405 0ustar00jannestaff[pytest11] instafail = pytest_instafail ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282629.0 pytest-instafail-0.5.0/pytest_instafail.egg-info/not-zip-safe0000644000076500000240000000000114411612005023326 0ustar00jannestaff ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282935.0 pytest-instafail-0.5.0/pytest_instafail.egg-info/requires.txt0000644000076500000240000000001214411612467023505 0ustar00jannestaffpytest>=5 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282935.0 pytest-instafail-0.5.0/pytest_instafail.egg-info/top_level.txt0000644000076500000240000000002114411612467023637 0ustar00jannestaffpytest_instafail ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282285.0 pytest-instafail-0.5.0/pytest_instafail.py0000644000076500000240000000623714411611255017776 0ustar00jannestaff""" pytest_instafail ~~~~~~~~~~~~~~~~ pytest plugin to show failures instantly. :copyright: (c) 2013-2016 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.hookimpl(trylast=True) def pytest_configure(config): if hasattr(config, 'workerinput'): return # xdist worker, we are already active on the master if config.option.instafail and config.pluginmanager.hasplugin('terminalreporter'): # 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: if self.isatty: self.rewrite('') # erase the "collecting"/"collected" message self.print_failure(report) def pytest_runtest_logreport(self, report): # Show failures and errors occurring during running a test # instantly. TerminalReporter.pytest_runtest_logreport(self, report) if report.failed and not hasattr(report, 'wasxfail'): 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 occurred. pass def summary_errors(self): # Prevent error summary from being shown since we already # show the error instantly after error has occurred. 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 report.when == "collect": 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) if not self.config.getvalue("usepdb"): self._outrep_summary(report) ././@PaxHeader0000000000000000000000000000003400000000000010212 xustar0028 mtime=1680282935.0786843 pytest-instafail-0.5.0/setup.cfg0000644000076500000240000000011314411612467015654 0ustar00jannestaff[tool:pytest] addopts = --color=yes [egg_info] tag_build = tag_date = 0 ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282411.0 pytest-instafail-0.5.0/setup.py0000644000076500000240000000263214411611453015547 0ustar00jannestafffrom setuptools import setup setup( name='pytest-instafail', description='pytest plugin to show failures instantly', long_description=open("README.rst").read(), version='0.5.0', url='https://github.com/pytest-dev/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>=5'], python_requires='>=3.7', classifiers=[ 'Development Status :: 4 - Beta', '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 :: 3', 'Programming Language :: Python :: 3 :: Only', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: 3.10', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: Implementation :: PyPy', ] ) ././@PaxHeader0000000000000000000000000000002600000000000010213 xustar0022 mtime=1680282285.0 pytest-instafail-0.5.0/test_instafail.py0000644000076500000240000002162514411611255017423 0ustar00jannestaffpytest_plugins = "pytester" import pytest class Option: def __init__(self, verbose=False, quiet=False, n=None): self.verbose = verbose self.quiet = quiet self.n = None @property def args(self): l = ['--instafail'] if self.verbose: l.append('-v') if self.quiet: l.append('-q') if self.n is not None: self.args.extend(['-n', str(self.n)]) return l @pytest.fixture(params=['normal', '1 worker', '2 worker']) def n(request): return { 'normal': None, '1 worker': 1, '2 worker': 2, }[request.param] @pytest.fixture(params=['default', 'verbose', 'quiet']) def option(request, n): return { "default": Option(verbose=False, n=n), "verbose": Option(verbose=True, n=n), "quiet": Option(quiet=True, n=n), }[request.param] class TestInstafailingTerminalReporter: 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:*:*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:*:*test_func*FAIL*", "* test_func *", " def test_func():", "> assert 0", "E assert 0", "test_fail_fail.py:3: AssertionError", "", "*test_fail_fail.py:*:*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:*:*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:*:*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:*:*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:*:*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 error*", ]) def test_print_stacktrace_once_with_pdb(self, testdir, request, option): test_file = testdir.makepyfile( """ def test_func(): assert 0 """ ) args = option.args args.append(" --pdb %s" % test_file) child = testdir.spawn_pytest(' '.join(args)) child.expect('>+ traceback >+') assert b'E assert 0' not in child.before child.expect('(Pdb)') child.sendeof() if child.isalive(): child.wait() def test_xfail_unexpected_success(self, testdir, option): testdir.makepyfile( """ import pytest @pytest.mark.xfail def test_func(): pass """ ) result = testdir.runpytest(*option.args) if option.verbose: result.stdout.fnmatch_lines([ "test_xfail_unexpected_success.py:*:*test_func XPASS*" ]) elif option.quiet: result.stdout.fnmatch_lines([ "X*" ]) else: result.stdout.fnmatch_lines([ "test_xfail_unexpected_success.py X*" ]) assert "INTERNALERROR" not in result.stdout.str()