| 1 |
--- a/test/test_ansi_escapes.py |
| 2 |
+++ b/test/test_ansi_escapes.py |
| 3 |
@@ -7,7 +7,7 @@ |
| 4 |
# W0621 Redefining name ... from outer scope |
| 5 |
|
| 6 |
from __future__ import absolute_import |
| 7 |
-from nose import tools |
| 8 |
+from . import tools |
| 9 |
from behave.formatter import ansi_escapes |
| 10 |
import unittest |
| 11 |
from six.moves import range |
| 12 |
--- /dev/null |
| 13 |
+++ b/test/tools.py |
| 14 |
@@ -0,0 +1,28 @@ |
| 15 |
+from pytest import raises as assert_raises |
| 16 |
+ |
| 17 |
+def eq_(a, b): |
| 18 |
+ assert a == b |
| 19 |
+ |
| 20 |
+def ok_(a, msg=None): |
| 21 |
+ assert a |
| 22 |
+ |
| 23 |
+from functools import wraps |
| 24 |
+ |
| 25 |
+def raises(*exceptions): |
| 26 |
+ valid = ' or '.join([e.__name__ for e in exceptions]) |
| 27 |
+ |
| 28 |
+ def decorate(func): |
| 29 |
+ name = func.__name__ |
| 30 |
+ def newfunc(*arg, **kw): |
| 31 |
+ try: |
| 32 |
+ func(*arg, **kw) |
| 33 |
+ except exceptions: |
| 34 |
+ pass |
| 35 |
+ except: |
| 36 |
+ raise |
| 37 |
+ else: |
| 38 |
+ message = "%s() did not raise %s" % (name, valid) |
| 39 |
+ raise AssertionError(message) |
| 40 |
+ newfunc = wraps(func)(newfunc) |
| 41 |
+ return newfunc |
| 42 |
+ return decorate |
| 43 |
--- a/test/test_configuration.py |
| 44 |
+++ b/test/test_configuration.py |
| 45 |
@@ -2,7 +2,7 @@ |
| 46 |
import sys |
| 47 |
import tempfile |
| 48 |
import six |
| 49 |
-from nose.tools import * |
| 50 |
+from .tools import eq_, ok_ |
| 51 |
from behave import configuration |
| 52 |
from behave.configuration import Configuration, UserData |
| 53 |
from unittest import TestCase |
| 54 |
--- a/test/test_formatter.py |
| 55 |
+++ b/test/test_formatter.py |
| 56 |
@@ -7,7 +7,7 @@ |
| 57 |
import unittest |
| 58 |
import six |
| 59 |
from mock import Mock, patch |
| 60 |
-from nose.tools import * # pylint: disable=wildcard-import, unused-wildcard-import |
| 61 |
+from .tools import eq_ |
| 62 |
|
| 63 |
from behave.formatter._registry import make_formatters |
| 64 |
from behave.formatter import pretty |
| 65 |
--- a/test/test_formatter_rerun.py |
| 66 |
+++ b/test/test_formatter_rerun.py |
| 67 |
@@ -8,7 +8,7 @@ |
| 68 |
from behave.model_core import Status |
| 69 |
from .test_formatter import FormatterTests as FormatterTest, _tf |
| 70 |
from .test_formatter import MultipleFormattersTests as MultipleFormattersTest |
| 71 |
-from nose.tools import * |
| 72 |
+from .tools import eq_ |
| 73 |
|
| 74 |
class TestRerunFormatter(FormatterTest): |
| 75 |
formatter_name = "rerun" |
| 76 |
--- a/test/test_importer.py |
| 77 |
+++ b/test/test_importer.py |
| 78 |
@@ -7,7 +7,7 @@ |
| 79 |
from __future__ import absolute_import |
| 80 |
from behave.importer import LazyObject, LazyDict, load_module, parse_scoped_name |
| 81 |
from behave.formatter.base import Formatter |
| 82 |
-from nose.tools import eq_, assert_raises |
| 83 |
+from .tools import eq_, assert_raises |
| 84 |
import sys |
| 85 |
import types |
| 86 |
# import unittest |
| 87 |
--- a/test/test_log_capture.py |
| 88 |
+++ b/test/test_log_capture.py |
| 89 |
@@ -1,6 +1,6 @@ |
| 90 |
from __future__ import absolute_import, with_statement |
| 91 |
|
| 92 |
-from nose.tools import * |
| 93 |
+from .tools import eq_ |
| 94 |
from mock import patch |
| 95 |
|
| 96 |
from behave.log_capture import LoggingCapture |
| 97 |
--- a/test/test_matchers.py |
| 98 |
+++ b/test/test_matchers.py |
| 99 |
@@ -1,7 +1,7 @@ |
| 100 |
# -*- coding: UTF-8 -*- |
| 101 |
from __future__ import absolute_import, with_statement |
| 102 |
from mock import Mock, patch |
| 103 |
-from nose.tools import * # pylint: disable=wildcard-import, unused-wildcard-import |
| 104 |
+from .tools import eq_, raises |
| 105 |
import parse |
| 106 |
from behave.matchers import Match, Matcher, ParseMatcher, RegexMatcher, \ |
| 107 |
SimplifiedRegexMatcher, CucumberRegexMatcher |
| 108 |
--- a/test/test_model.py |
| 109 |
+++ b/test/test_model.py |
| 110 |
@@ -4,7 +4,7 @@ |
| 111 |
from __future__ import absolute_import, print_function, with_statement |
| 112 |
import unittest |
| 113 |
from mock import Mock, patch |
| 114 |
-from nose.tools import * # pylint: disable=wildcard-import, unused-wildcard-import |
| 115 |
+from .tools import eq_, raises |
| 116 |
import six |
| 117 |
from six.moves import range # pylint: disable=redefined-builtin |
| 118 |
from six.moves import zip # pylint: disable=redefined-builtin |
| 119 |
--- a/test/test_parser.py |
| 120 |
+++ b/test/test_parser.py |
| 121 |
@@ -1,7 +1,7 @@ |
| 122 |
#-*- coding: UTF-8 -*- |
| 123 |
|
| 124 |
from __future__ import absolute_import |
| 125 |
-from nose.tools import * |
| 126 |
+from .tools import eq_, assert_raises, raises |
| 127 |
|
| 128 |
from behave import i18n, model, parser |
| 129 |
|
| 130 |
--- a/test/test_runner.py |
| 131 |
+++ b/test/test_runner.py |
| 132 |
@@ -13,7 +13,7 @@ |
| 133 |
from six import StringIO |
| 134 |
|
| 135 |
from mock import Mock, patch |
| 136 |
-from nose.tools import * # pylint: disable=wildcard-import, unused-wildcard-import |
| 137 |
+from .tools import eq_, ok_, raises, assert_raises |
| 138 |
|
| 139 |
from behave import runner_util |
| 140 |
from behave.model import Table |
| 141 |
--- a/test/test_step_registry.py |
| 142 |
+++ b/test/test_step_registry.py |
| 143 |
@@ -2,7 +2,7 @@ |
| 144 |
# pylint: disable=unused-wildcard-import |
| 145 |
from __future__ import absolute_import, with_statement |
| 146 |
from mock import Mock, patch |
| 147 |
-from nose.tools import * # pylint: disable=wildcard-import |
| 148 |
+from .tools import eq_ |
| 149 |
from six.moves import range # pylint: disable=redefined-builtin |
| 150 |
from behave import step_registry |
| 151 |
|
| 152 |
--- a/test/test_tag_expression.py |
| 153 |
+++ b/test/test_tag_expression.py |
| 154 |
@@ -2,7 +2,7 @@ |
| 155 |
|
| 156 |
from __future__ import absolute_import |
| 157 |
from behave.tag_expression import TagExpression |
| 158 |
-from nose import tools |
| 159 |
+from . import tools |
| 160 |
import unittest |
| 161 |
|
| 162 |
|
| 163 |
--- a/test/test_tag_expression2.py |
| 164 |
+++ b/test/test_tag_expression2.py |
| 165 |
@@ -7,7 +7,7 @@ |
| 166 |
|
| 167 |
from __future__ import absolute_import |
| 168 |
from behave.tag_expression import TagExpression |
| 169 |
-from nose import tools |
| 170 |
+from . import tools |
| 171 |
import itertools |
| 172 |
from six.moves import range |
| 173 |
|
| 174 |
--- a/test/reporters/test_summary.py |
| 175 |
+++ b/test/reporters/test_summary.py |
| 176 |
@@ -3,7 +3,7 @@ |
| 177 |
from __future__ import absolute_import, division |
| 178 |
import sys |
| 179 |
from mock import Mock, patch |
| 180 |
-from nose.tools import * |
| 181 |
+from ..tools import * |
| 182 |
from behave.model import ScenarioOutline, Scenario |
| 183 |
from behave.model_core import Status |
| 184 |
from behave.reporter.summary import SummaryReporter, format_summary |