Skip to content

Commit e0bffc8

Browse files
remove veracitools #233
1 parent b15f300 commit e0bffc8

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

requirements/requirements-test.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,4 @@ pytest>=4.6.9
33
pytest-cov>=2.8.1
44
hypothesis==4.38.0
55
coveralls
6-
veracitools
76
pytest-remotedata

tests/helpers.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,32 @@ def __init__(self, *args, **kwargs):
6767
kwd_args = {"multi": True} # Like interactive mode.
6868
kwd_args.update(kwargs)
6969
super(SafeTestPipeline, self).__init__(*args, **kwd_args)
70+
71+
# originally imported from veracitools v0.1.4 (now deprecated)
72+
class ExpectContext(object):
73+
""" Pytest validation context, a framework for varied kinds of expectations. """
74+
75+
def __init__(self, expected, test_func):
76+
"""
77+
Create the test context by specifying expectation and function.
78+
79+
:param object | type expected: expected result or exception
80+
:param callable test_func: the callable object to test
81+
"""
82+
self._f = test_func
83+
self._exp = expected
84+
85+
def __enter__(self):
86+
""" Return the instance for use as a callable. """
87+
return self
88+
89+
def __exit__(self, exc_type, exc_val, exc_tb):
90+
pass
91+
92+
def __call__(self, *args, **kwargs):
93+
""" Execute the instance's function, passing given args/kwargs. """
94+
if isinstance(self._exp, type) and issubclass(self._exp, Exception):
95+
with pytest.raises(self._exp):
96+
self._f(*args, **kwargs)
97+
else:
98+
assert self._exp == self._f(*args, **kwargs)

tests/utils_tests/test_check_command_callability.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import mock
66
import pytest
77
from ubiquerg import powerset
8-
from veracitools import ExpectContext
8+
from tests.helpers import ExpectContext
99

1010
from pypiper import utils as piper_utils
1111

0 commit comments

Comments
 (0)