Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from gabbi import driver
from gabbi import fixture
from gabbi import handlers
from gabbi import simple_wsgi
TESTS_DIR = 'gabbits_intercept'
class TestFixtureOne(fixture.GabbiFixture):
"""Drive the fixture testing weakly."""
pass
class TestFixtureTwo(fixture.GabbiFixture):
"""Drive the fixture testing weakly."""
pass
class TestResponseHandler(handlers.ResponseHandler):
"""A sample response handler just to test."""
test_key_suffix = 'test'
test_key_value = []
def preprocess(self, test):
"""Add some data if the data is a string."""
try:
test.output = test.output + '\nAnother line'
except TypeError:
pass
"""
import os
import sys
from gabbi import driver
from gabbi import fixture
from gabbi import handlers
from gabbi import simple_wsgi
TESTS_DIR = 'gabbits_intercept'
class TestFixtureOne(fixture.GabbiFixture):
"""Drive the fixture testing weakly."""
pass
class TestFixtureTwo(fixture.GabbiFixture):
"""Drive the fixture testing weakly."""
pass
class TestResponseHandler(handlers.ResponseHandler):
"""A sample response handler just to test."""
test_key_suffix = 'test'
test_key_value = []
def preprocess(self, test):
def _get_intercept(self):
fixtures = [fixture.GabbiFixture]
intercept = host = port = prefix = None
try:
first_test = self._find_first_full_test()
fixtures = first_test.fixtures
host = first_test.host
port = first_test.port
prefix = first_test.prefix
intercept = first_test.intercept
# Unbind a passed in WSGI application. During the
# metaclass building process intercept becomes bound.
try:
intercept = intercept.__func__
except AttributeError:
pass
except AttributeError:
def __exit__(self, exc_type, value, traceback):
self.exc_type = exc_type
self.exc_value = value
self.traceback = traceback
self.stop_fixture()
def start_fixture(self):
"""Implement the actual workings of starting the fixture here."""
pass
def stop_fixture(self):
"""Implement the actual workings of stopping the fixture here."""
pass
class SkipAllFixture(GabbiFixture):
"""A fixture that skips all the tests in the current suite."""
def start_fixture(self):
raise case.SkipTest('entire suite skipped')
@contextlib.contextmanager
def nest(fixtures):
"""Nest a series of fixtures.
This is duplicated from ``nested`` in the stdlib, which has been
deprecated because of issues with how exceptions are difficult to
handle during ``__init__``. Gabbi needs to nest an unknown number
of fixtures dynamically, so the ``with`` syntax that replaces
``nested`` will not work.
"""