mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-11 00:01:54 +08:00
refactored test_integration, so that those tests can be called from multiple places.
This commit is contained in:
32
test/base.py
32
test/base.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user