summaryrefslogtreecommitdiff
path: root/testlib.py
diff options
context:
space:
mode:
authorJulien Jehannet <julien.jehannet@logilab.fr>2010-11-24 18:32:48 +0100
committerJulien Jehannet <julien.jehannet@logilab.fr>2010-11-24 18:32:48 +0100
commit8e09acd966ade8febcc92119491d0f45ed9a315f (patch)
treeb6cf612f206a2946908019d23220667f2d15d3c2 /testlib.py
parentcb76856153644bcd55c49e3386d60d1abe04fbdc (diff)
downloadlogilab-common-8e09acd966ade8febcc92119491d0f45ed9a315f.tar.gz
[testlib] move dbc feature into pytest module + correct wrong import
Diffstat (limited to 'testlib.py')
-rw-r--r--testlib.py27
1 files changed, 2 insertions, 25 deletions
diff --git a/testlib.py b/testlib.py
index cbde8e2..6750f7b 100644
--- a/testlib.py
+++ b/testlib.py
@@ -98,9 +98,6 @@ __all__ = ['main', 'unittest_main', 'find_tests', 'run_test', 'spawn']
DEFAULT_PREFIXES = ('test', 'regrtest', 'smoketest', 'unittest',
'func', 'validation')
-ENABLE_DBC = False
-
-FILE_RESTART = ".pytest.restart"
if sys.version_info >= (2, 6):
# FIXME : this does not work as expected / breaks tests on testlib
@@ -659,6 +656,7 @@ class TestCase(unittest.TestCase):
This is mostly a copy/paste from unittest.py (i.e same
variable names, same logic, except for the generative tests part)
"""
+ from logilab.common.pytest import FILE_RESTART
if result is None:
result = self.defaultTestResult()
result.pdbclass = self.pdbclass
@@ -1319,7 +1317,7 @@ class DocTest(TestCase):
"""
skipped = ()
def __call__(self, result=None, runcondition=None, options=None):\
- # pylint: disable=W0613
+ # pylint: disable=W0613
try:
finder = DocTestFinder(skipped=self.skipped)
if sys.version_info >= (2, 4):
@@ -1447,27 +1445,6 @@ def create_files(paths, chroot):
for filepath in files:
open(filepath, 'w').close()
-def enable_dbc(*args):
- """
- Without arguments, return True if contracts can be enabled and should be
- enabled (see option -d), return False otherwise.
-
- With arguments, return False if contracts can't or shouldn't be enabled,
- otherwise weave ContractAspect with items passed as arguments.
- """
- if not ENABLE_DBC:
- return False
- try:
- from logilab.aspects.weaver import weaver
- from logilab.aspects.lib.contracts import ContractAspect
- except ImportError:
- sys.stderr.write(
- 'Warning: logilab.aspects is not available. Contracts disabled.')
- return False
- for arg in args:
- weaver.weave_module(arg, ContractAspect)
- return True
-
class AttrObject: # XXX cf mock_object
def __init__(self, **kwargs):