forked from pool/python-behave
Accepting request 977800 from home:pgajdos:python
- test the package - do not require python-mock for build - added patches83906ba77966fcadb23b+ python-behave-fix-tests.patch fix https://github.com/behave/behave/issues/1028 + python-behave-no-mock.patch OBS-URL: https://build.opensuse.org/request/show/977800 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-behave?expand=0&rev=9
This commit is contained in:
98
python-behave-fix-tests.patch
Normal file
98
python-behave-fix-tests.patch
Normal file
@@ -0,0 +1,98 @@
|
||||
Index: behave-1.2.6/tests/unit/test_capture.py
|
||||
===================================================================
|
||||
--- behave-1.2.6.orig/tests/unit/test_capture.py
|
||||
+++ behave-1.2.6/tests/unit/test_capture.py
|
||||
@@ -20,6 +20,8 @@ def create_capture_controller(config=Non
|
||||
config.log_capture = True
|
||||
config.logging_filter = None
|
||||
config.logging_level = "INFO"
|
||||
+ config.logging_format = "%(levelname)s:%(name)s:%(message)s"
|
||||
+ config.logging_datefmt = None
|
||||
return CaptureController(config)
|
||||
|
||||
def setup_capture_controller(capture_controller, context=None):
|
||||
Index: behave-1.2.6/tests/issues/test_issue0458.py
|
||||
===================================================================
|
||||
--- behave-1.2.6.orig/tests/issues/test_issue0458.py
|
||||
+++ behave-1.2.6/tests/issues/test_issue0458.py
|
||||
@@ -48,7 +48,7 @@ def test_issue(exception_class, message)
|
||||
raise_exception(exception_class, message)
|
||||
|
||||
# -- SHOULD NOT RAISE EXCEPTION HERE:
|
||||
- text = _text(e)
|
||||
+ text = _text(e.value)
|
||||
# -- DIAGNOSTICS:
|
||||
print(u"text"+ text)
|
||||
print(u"exception: %s" % e)
|
||||
Index: behave-1.2.6/tests/unit/test_context_cleanups.py
|
||||
===================================================================
|
||||
--- behave-1.2.6.orig/tests/unit/test_context_cleanups.py
|
||||
+++ behave-1.2.6/tests/unit/test_context_cleanups.py
|
||||
@@ -153,7 +153,7 @@ class TestContextCleanup(object):
|
||||
with pytest.raises(AssertionError) as e:
|
||||
with scoped_context_layer(context):
|
||||
context.add_cleanup(non_callable)
|
||||
- assert "REQUIRES: callable(cleanup_func)" in str(e)
|
||||
+ assert "REQUIRES: callable(cleanup_func)" in str(e.value)
|
||||
|
||||
def test_on_cleanup_error__prints_error_by_default(self, capsys):
|
||||
def bad_cleanup_func():
|
||||
Index: behave-1.2.6/tests/unit/test_textutil.py
|
||||
===================================================================
|
||||
--- behave-1.2.6.orig/tests/unit/test_textutil.py
|
||||
+++ behave-1.2.6/tests/unit/test_textutil.py
|
||||
@@ -212,9 +212,11 @@ class TestObjectToTextConversion(object)
|
||||
with pytest.raises(AssertionError) as e:
|
||||
assert False, message
|
||||
|
||||
- text2 = text(e)
|
||||
- expected = u"AssertionError: %s" % message
|
||||
- assert text2.endswith(expected)
|
||||
+ # -- FOR: pytest < 5.0
|
||||
+ # expected = u"AssertionError: %s" % message
|
||||
+ text2 = text(e.value)
|
||||
+ assert u"AssertionError" in text(e)
|
||||
+ assert message in text2, "OOPS: text=%r" % text2
|
||||
|
||||
@requires_python2
|
||||
@pytest.mark.parametrize("message", [
|
||||
@@ -226,9 +228,11 @@ class TestObjectToTextConversion(object)
|
||||
with pytest.raises(AssertionError) as e:
|
||||
assert False, bytes_message
|
||||
|
||||
- text2 = text(e)
|
||||
- expected = u"AssertionError: %s" % message
|
||||
- assert text2.endswith(expected)
|
||||
+ # -- FOR: pytest < 5.0
|
||||
+ # expected = u"AssertionError: %s" % message
|
||||
+ text2 = text(e.value)
|
||||
+ assert message in text2, "OOPS: text=%r" % text2
|
||||
+
|
||||
|
||||
@pytest.mark.parametrize("exception_class, message", [
|
||||
(AssertionError, u"Ärgernis"),
|
||||
@@ -240,10 +244,13 @@ class TestObjectToTextConversion(object)
|
||||
with pytest.raises(exception_class) as e:
|
||||
raise exception_class(message)
|
||||
|
||||
- text2 = text(e)
|
||||
+ # -- FOR: pytest < 5.0
|
||||
+ # expected = u"AssertionError: %s" % message
|
||||
+ text2 = text(e.value)
|
||||
expected = u"%s: %s" % (exception_class.__name__, message)
|
||||
assert isinstance(text2, six.text_type)
|
||||
- assert text2.endswith(expected)
|
||||
+ assert exception_class.__name__ in str(e)
|
||||
+ assert message in text2, "OOPS: text=%r" % text2
|
||||
|
||||
@requires_python2
|
||||
@pytest.mark.parametrize("exception_class, message", [
|
||||
@@ -257,7 +264,7 @@ class TestObjectToTextConversion(object)
|
||||
with pytest.raises(exception_class) as e:
|
||||
raise exception_class(bytes_message)
|
||||
|
||||
- text2 = text(e)
|
||||
+ text2 = text(e.value)
|
||||
unicode_message = bytes_message.decode(self.ENCODING)
|
||||
expected = u"%s: %s" % (exception_class.__name__, unicode_message)
|
||||
assert isinstance(text2, six.text_type)
|
||||
Reference in New Issue
Block a user