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)
|
||||
143
python-behave-no-mock.patch
Normal file
143
python-behave-no-mock.patch
Normal file
@@ -0,0 +1,143 @@
|
||||
diff -upr behave-1.2.6.orig/test/reporters/test_summary.py behave-1.2.6/test/reporters/test_summary.py
|
||||
--- behave-1.2.6.orig/test/reporters/test_summary.py 2022-05-17 16:51:03.364286060 +0200
|
||||
+++ behave-1.2.6/test/reporters/test_summary.py 2022-05-17 16:51:03.432286489 +0200
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import absolute_import, division
|
||||
import sys
|
||||
-from mock import Mock, patch
|
||||
+from unittest.mock import Mock, patch
|
||||
from nose.tools import *
|
||||
from behave.model import ScenarioOutline, Scenario
|
||||
from behave.model_core import Status
|
||||
diff -upr behave-1.2.6.orig/test/test_formatter.py behave-1.2.6/test/test_formatter.py
|
||||
--- behave-1.2.6.orig/test/test_formatter.py 2022-05-17 16:51:03.364286060 +0200
|
||||
+++ behave-1.2.6/test/test_formatter.py 2022-05-17 16:51:03.432286489 +0200
|
||||
@@ -6,7 +6,7 @@ import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import six
|
||||
-from mock import Mock, patch
|
||||
+from unittest.mock import Mock, patch
|
||||
from nose.tools import * # pylint: disable=wildcard-import, unused-wildcard-import
|
||||
|
||||
from behave.formatter._registry import make_formatters
|
||||
diff -upr behave-1.2.6.orig/test/test_log_capture.py behave-1.2.6/test/test_log_capture.py
|
||||
--- behave-1.2.6.orig/test/test_log_capture.py 2022-05-17 16:51:03.364286060 +0200
|
||||
+++ behave-1.2.6/test/test_log_capture.py 2022-05-17 16:51:03.436286514 +0200
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import absolute_import, with_statement
|
||||
|
||||
from nose.tools import *
|
||||
-from mock import patch
|
||||
+from unittest.mock import patch
|
||||
|
||||
from behave.log_capture import LoggingCapture
|
||||
from six.moves import range
|
||||
diff -upr behave-1.2.6.orig/test/test_matchers.py behave-1.2.6/test/test_matchers.py
|
||||
--- behave-1.2.6.orig/test/test_matchers.py 2022-05-17 16:51:03.364286060 +0200
|
||||
+++ behave-1.2.6/test/test_matchers.py 2022-05-17 16:51:03.436286514 +0200
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
from __future__ import absolute_import, with_statement
|
||||
-from mock import Mock, patch
|
||||
+from unittest.mock import Mock, patch
|
||||
from nose.tools import * # pylint: disable=wildcard-import, unused-wildcard-import
|
||||
import parse
|
||||
from behave.matchers import Match, Matcher, ParseMatcher, RegexMatcher, \
|
||||
diff -upr behave-1.2.6.orig/test/test_model.py behave-1.2.6/test/test_model.py
|
||||
--- behave-1.2.6.orig/test/test_model.py 2022-05-17 16:51:03.364286060 +0200
|
||||
+++ behave-1.2.6/test/test_model.py 2022-05-17 16:51:03.436286514 +0200
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
from __future__ import absolute_import, print_function, with_statement
|
||||
import unittest
|
||||
-from mock import Mock, patch
|
||||
+from unittest.mock import Mock, patch
|
||||
from nose.tools import * # pylint: disable=wildcard-import, unused-wildcard-import
|
||||
import six
|
||||
from six.moves import range # pylint: disable=redefined-builtin
|
||||
diff -upr behave-1.2.6.orig/test/test_runner.py behave-1.2.6/test/test_runner.py
|
||||
--- behave-1.2.6.orig/test/test_runner.py 2022-05-17 16:51:03.364286060 +0200
|
||||
+++ behave-1.2.6/test/test_runner.py 2022-05-17 16:51:03.436286514 +0200
|
||||
@@ -12,7 +12,7 @@ import unittest
|
||||
import six
|
||||
from six import StringIO
|
||||
|
||||
-from mock import Mock, patch
|
||||
+from unittest.mock import Mock, patch
|
||||
from nose.tools import * # pylint: disable=wildcard-import, unused-wildcard-import
|
||||
|
||||
from behave import runner_util
|
||||
diff -upr behave-1.2.6.orig/test/test_step_registry.py behave-1.2.6/test/test_step_registry.py
|
||||
--- behave-1.2.6.orig/test/test_step_registry.py 2022-05-17 16:51:03.364286060 +0200
|
||||
+++ behave-1.2.6/test/test_step_registry.py 2022-05-17 16:51:03.436286514 +0200
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- coding: UTF-8 -*-
|
||||
# pylint: disable=unused-wildcard-import
|
||||
from __future__ import absolute_import, with_statement
|
||||
-from mock import Mock, patch
|
||||
+from unittest.mock import Mock, patch
|
||||
from nose.tools import * # pylint: disable=wildcard-import
|
||||
from six.moves import range # pylint: disable=redefined-builtin
|
||||
from behave import step_registry
|
||||
diff -upr behave-1.2.6.orig/test/test_tag_matcher.py behave-1.2.6/test/test_tag_matcher.py
|
||||
--- behave-1.2.6.orig/test/test_tag_matcher.py 2022-05-17 16:51:03.364286060 +0200
|
||||
+++ behave-1.2.6/test/test_tag_matcher.py 2022-05-17 16:51:03.436286514 +0200
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
from __future__ import absolute_import
|
||||
from behave.tag_matcher import *
|
||||
-from mock import Mock
|
||||
+from unittest.mock import Mock
|
||||
from unittest import TestCase
|
||||
import warnings
|
||||
# -- REQUIRES: pytest
|
||||
diff -upr behave-1.2.6.orig/tests/api/_test_async_step34.py behave-1.2.6/tests/api/_test_async_step34.py
|
||||
--- behave-1.2.6.orig/tests/api/_test_async_step34.py 2022-05-17 16:51:03.412286363 +0200
|
||||
+++ behave-1.2.6/tests/api/_test_async_step34.py 2022-05-17 16:51:03.436286514 +0200
|
||||
@@ -9,7 +9,7 @@ from behave.api.async_step import AsyncC
|
||||
from behave._stepimport import use_step_import_modules
|
||||
from behave.runner import Context, Runner
|
||||
import sys
|
||||
-from mock import Mock
|
||||
+from unittest.mock import Mock
|
||||
import pytest
|
||||
|
||||
from .testing_support import StopWatch, SimpleStepContainer
|
||||
diff -upr behave-1.2.6.orig/tests/unit/test_capture.py behave-1.2.6/tests/unit/test_capture.py
|
||||
--- behave-1.2.6.orig/tests/unit/test_capture.py 2022-05-17 16:51:03.412286363 +0200
|
||||
+++ behave-1.2.6/tests/unit/test_capture.py 2022-05-17 16:51:03.440286539 +0200
|
||||
@@ -6,7 +6,7 @@ Unittests for :mod:`behave.capture` modu
|
||||
from __future__ import absolute_import, print_function
|
||||
import sys
|
||||
from behave.capture import Captured, CaptureController
|
||||
-from mock import Mock
|
||||
+from unittest.mock import Mock
|
||||
import pytest
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
diff -upr behave-1.2.6.orig/tests/unit/test_context_cleanups.py behave-1.2.6/tests/unit/test_context_cleanups.py
|
||||
--- behave-1.2.6.orig/tests/unit/test_context_cleanups.py 2022-05-17 16:51:03.412286363 +0200
|
||||
+++ behave-1.2.6/tests/unit/test_context_cleanups.py 2022-05-17 16:51:03.440286539 +0200
|
||||
@@ -13,7 +13,7 @@ OPEN ISSUES:
|
||||
from __future__ import print_function
|
||||
from behave.runner import Context, scoped_context_layer
|
||||
from contextlib import contextmanager
|
||||
-from mock import Mock, NonCallableMock
|
||||
+from unittest.mock import Mock, NonCallableMock
|
||||
import pytest
|
||||
|
||||
|
||||
diff -upr behave-1.2.6.orig/tests/unit/test_fixture.py behave-1.2.6/tests/unit/test_fixture.py
|
||||
--- behave-1.2.6.orig/tests/unit/test_fixture.py 2022-05-17 16:51:03.412286363 +0200
|
||||
+++ behave-1.2.6/tests/unit/test_fixture.py 2022-05-17 16:51:03.440286539 +0200
|
||||
@@ -12,7 +12,7 @@ from behave.fixture import \
|
||||
from behave.runner import Context, CleanupError, scoped_context_layer
|
||||
from behave._types import Unknown
|
||||
import pytest
|
||||
-from mock import Mock
|
||||
+from unittest.mock import Mock
|
||||
import six
|
||||
|
||||
|
||||
@@ -1,3 +1,15 @@
|
||||
-------------------------------------------------------------------
|
||||
Tue May 17 14:54:59 UTC 2022 - pgajdos@suse.com
|
||||
|
||||
- test the package
|
||||
- do not require python-mock for build
|
||||
- added patches
|
||||
https://github.com/behave/behave/commit/83906ba779956af9437defcb8975debb18440e0d
|
||||
https://github.com/behave/behave/commit/66fcadb23bea79e60f370e66bf7588de2f1934e3
|
||||
+ python-behave-fix-tests.patch
|
||||
fix https://github.com/behave/behave/issues/1028
|
||||
+ python-behave-no-mock.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Mar 1 09:46:46 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
||||
@@ -26,6 +26,11 @@ Group: Development/Languages/Python
|
||||
URL: https://github.com/behave/behave
|
||||
Source: https://files.pythonhosted.org/packages/source/b/behave/behave-%{version}.tar.gz
|
||||
Patch1: no2to3.patch
|
||||
# https://github.com/behave/behave/commit/83906ba779956af9437defcb8975debb18440e0d
|
||||
# https://github.com/behave/behave/commit/66fcadb23bea79e60f370e66bf7588de2f1934e3
|
||||
Patch2: python-behave-fix-tests.patch
|
||||
# https://github.com/behave/behave/issues/1028
|
||||
Patch3: python-behave-no-mock.patch
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module setuptools}
|
||||
BuildRequires: fdupes
|
||||
@@ -55,7 +60,6 @@ Suggests: python-traceback2
|
||||
BuildArch: noarch
|
||||
# SECTION test requirements
|
||||
BuildRequires: %{python_module PyHamcrest >= 1.8}
|
||||
BuildRequires: %{python_module mock >= 1.1}
|
||||
BuildRequires: %{python_module parse >= 1.8.2}
|
||||
BuildRequires: %{python_module parse_type >= 0.4.2}
|
||||
BuildRequires: %{python_module path.py >= 10.1}
|
||||
@@ -73,8 +77,7 @@ non-technical or business participants in a software project.
|
||||
code.
|
||||
|
||||
%prep
|
||||
%setup -q -n behave-%{version}
|
||||
%patch1 -p1
|
||||
%autosetup -p1 -n behave-%{version}
|
||||
|
||||
%build
|
||||
%python_build
|
||||
@@ -85,6 +88,7 @@ code.
|
||||
%python_expand %fdupes %{buildroot}%{$python_sitelib}
|
||||
|
||||
%check
|
||||
%pytest tests
|
||||
|
||||
%post
|
||||
%python_install_alternative behave
|
||||
|
||||
Reference in New Issue
Block a user