refactored test_integration, so that those tests can be called from multiple places.

This commit is contained in:
David Halter
2013-04-20 21:55:08 +04:30
parent 2b1ea33fe8
commit d16f5f6a4c
3 changed files with 77 additions and 119 deletions

View File

@@ -7,10 +7,7 @@ import os
from os.path import abspath, dirname
import functools
import pytest
import jedi
from jedi._compatibility import is_py25
test_dir = dirname(abspath(__file__))
@@ -63,32 +60,3 @@ def cwd_at(path):
os.chdir(oldcwd)
return wrapper
return decorator
_py25_fails = 0
py25_allowed_fails = 9
def skip_py25_fails(func):
"""
Skip first `py25_allowed_fails` failures in Python 2.5.
.. todo:: Remove this decorator by implementing "skip tag" for
integration tests.
"""
@functools.wraps(func)
def wrapper(*args, **kwds):
global _py25_fails
try:
func(*args, **kwds)
except AssertionError:
_py25_fails += 1
if _py25_fails > py25_allowed_fails:
raise
else:
pytest.skip("%d-th failure (there can be %d failures)" %
(_py25_fails, py25_allowed_fails))
return wrapper
if not is_py25:
skip_py25_fails = lambda f: f