[py-svn] commit/pytest-cache: RonnyPfannschmidt: test and fix issue 4
Bitbucket
commits-noreply at bitbucket.org
Tue Jul 10 09:39:58 CEST 2012
1 new commit in pytest-cache:
https://bitbucket.org/hpk42/pytest-cache/changeset/bc61694438e9/
changeset: bc61694438e9
user: RonnyPfannschmidt
date: 2012-07-10 09:39:40
summary: test and fix issue 4
consider setup time skip of a previous fail no longer a fail
affected #: 3 files
diff -r 27cda0c4b038562cbe7d281e2323539cf7487710 -r bc61694438e9cdd3ce0296b8379f8f82b694aae5 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+
+- fix issue 4: consider setup time skip of a previous failure
+ as no longer failing
+
0.9
----------------------------------------------
diff -r 27cda0c4b038562cbe7d281e2323539cf7487710 -r bc61694438e9cdd3ce0296b8379f8f82b694aae5 pytest_cache.py
--- a/pytest_cache.py
+++ b/pytest_cache.py
@@ -130,7 +130,9 @@
if report.failed:
self.lastfailed.add(report.nodeid)
else:
- if report.when == "call":
+ call = report.when == "call"
+ skipped_setup = report.when == 'setup' and report.skipped
+ if call or skipped_setup:
try:
self.lastfailed.remove(report.nodeid)
except KeyError:
diff -r 27cda0c4b038562cbe7d281e2323539cf7487710 -r bc61694438e9cdd3ce0296b8379f8f82b694aae5 test_cache.py
--- a/test_cache.py
+++ b/test_cache.py
@@ -160,3 +160,68 @@
result.stdout.fnmatch_lines([
"*2 failed*",
])
+
+ @pytest.mark.skipif("sys.version_info < (2,6)")
+ def test_lastfailed_failure_to_skip_is_passsed(self, testdir, monkeypatch):
+ monkeypatch.setenv("PYTHONDONTWRITEBYTECODE", 1)
+ p1 = testdir.makepyfile("""
+ import os
+ import pytest
+ def skipat(when):
+ if os.environ.get("SKIPAT") == when:
+ pytest.skip(when)
+
+ def setup_module(mod):
+ skipat('setup')
+
+ def test_configured_skip():
+ skipat('test')
+ assert 0
+ """)
+ p2 = testdir.tmpdir.join('test_fail.py').write(py.code.Source("""
+ def test_keepfail():
+ assert 0
+ """))
+
+ result = testdir.runpytest("--lf")
+ result.stdout.fnmatch_lines([
+ "*2 failed*",
+ ])
+
+ monkeypatch.setenv("SKIPAT", 'test')
+
+ result = testdir.runpytest("--lf")
+ result.stdout.fnmatch_lines([
+ "*1 skipped*",
+ ])
+
+ result = testdir.runpytest("--lf")
+ result.stdout.fnmatch_lines([
+ "*1 deselected*",
+ ])
+
+ monkeypatch.delenv('SKIPAT')
+
+ result = testdir.runpytest()
+ result.stdout.fnmatch_lines([
+ "*2 failed*",
+ ])
+
+ monkeypatch.setenv("SKIPAT", 'setup')
+
+ result = testdir.runpytest("--lf")
+ result.stdout.fnmatch_lines([
+ "*1 skipped*",
+ ])
+ #XXX: check cache
+ result = testdir.runpytest("--lf")
+ result.stdout.fnmatch_lines([
+ "*1 deselected*",
+ ])
+
+ monkeypatch.delenv('SKIPAT')
+
+ result = testdir.runpytest("--lf")
+ result.stdout.fnmatch_lines([
+ "*1 failed*",
+ ])
Repository URL: https://bitbucket.org/hpk42/pytest-cache/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list