15
0
forked from pool/python-behave

- fix usage of libalternatives

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-behave?expand=0&rev=15
This commit is contained in:
2025-06-04 15:05:44 +00:00
committed by Git OBS Bridge
commit 6017189e6a
8 changed files with 449 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.osc

3
behave-1.2.6.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b9662327aa53294c1351b0a9c369093ccec1d21026f050c3bd9b3e5cccf81a86
size 701696

13
no2to3.patch Normal file
View File

@@ -0,0 +1,13 @@
Index: behave-1.2.6/setup.py
===================================================================
--- behave-1.2.6.orig/setup.py
+++ behave-1.2.6/setup.py
@@ -100,8 +100,6 @@ setup(
"pylint",
],
},
- # MAYBE-DISABLE: use_2to3
- use_2to3= bool(python_version >= 3.0),
license="BSD",
classifiers=[
"Development Status :: 4 - Beta",

View 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
View 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

57
python-behave.changes Normal file
View File

@@ -0,0 +1,57 @@
-------------------------------------------------------------------
Wed Jun 4 15:05:03 UTC 2025 - Nico Krapp <nico.krapp@suse.com>
- fix usage of libalternatives
-------------------------------------------------------------------
Wed May 14 09:11:38 UTC 2025 - Markéta Machová <mmachova@suse.com>
- Convert to pip-based build
-------------------------------------------------------------------
Thu Sep 26 17:53:18 UTC 2024 - Guang Yee <gyee@suse.com>
- Enable sle15_python_module_pythons.
-------------------------------------------------------------------
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>
- add no2to3.patch for compatibility with newer setuptools
-------------------------------------------------------------------
Wed Sep 8 06:52:58 UTC 2021 - Steve Kowalik <steven.kowalik@suse.com>
- Drop unnecessary BuildRequires on nose.
-------------------------------------------------------------------
Wed May 27 09:36:27 UTC 2020 - Petr Gajdos <pgajdos@suse.com>
- %python3_only -> %python_alternative
-------------------------------------------------------------------
Sun Mar 24 11:04:29 UTC 2019 - Jan Engelhardt <jengelh@inai.de>
- Avoid name repetition in summary. (Something rpmlint would
warn about.)
-------------------------------------------------------------------
Sat Mar 23 16:20:20 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Fix the license and friends
-------------------------------------------------------------------
Wed Nov 28 20:44:17 UTC 2018 - Mathias Homann <Mathias.Homann@opensuse.org>
- initial package using 1.2.6 and py2pack

111
python-behave.spec Normal file
View File

@@ -0,0 +1,111 @@
#
# spec file for package python-behave
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%bcond_without libalternatives
%{?sle15_python_module_pythons}
Name: python-behave
Version: 1.2.6
Release: 0
Summary: Behaviour-driven development, Python style
License: BSD-2-Clause
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 pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: alts
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: alts
Requires: python-parse >= 1.8.2
Requires: python-parse_type >= 0.4.2
Requires: python-six >= 1.11
Suggests: python-argparse
Suggests: python-coverage
Suggests: python-enum34
Suggests: python-importlib
Suggests: python-invoke >= 0.21.0
Suggests: python-modernize >= 0.5
Suggests: python-ordereddict
Suggests: python-path.py >= 8.1.2
Suggests: python-pathlib
Suggests: python-pycmd
Suggests: python-pylint
Suggests: python-pytest >= 3.0
Suggests: python-pytest-cov
Suggests: python-sphinx >= 1.6
Suggests: python-sphinx_bootstrap_theme >= 0.6
Suggests: python-tox
Suggests: python-traceback2
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module PyHamcrest >= 1.8}
BuildRequires: %{python_module parse >= 1.8.2}
BuildRequires: %{python_module parse_type >= 0.4.2}
BuildRequires: %{python_module path.py >= 10.1}
BuildRequires: %{python_module pytest >= 3.0}
BuildRequires: %{python_module six >= 1.11}
# /SECTION
%python_subpackages
%description
Behavior-driven development (or BDD) is an agile software development
technique that encourages collaboration between developers, QA and
non-technical or business participants in a software project.
*behave* uses tests written in a natural language style, backed up by Python
code.
%prep
%autosetup -p1 -n behave-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/behave
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest tests
%pre
# If libalternatives is used: Removing old update-alternatives entries.
%python_libalternatives_reset_alternative behave
# post and postun macro call is not needed with only libalternatives
%files %{python_files}
%license LICENSE
%doc CHANGES.rst README.rst
%python_alternative %{_bindir}/behave
%{python_sitelib}/behave
%{python_sitelib}/setuptools_behave.py
%pycache_only %{python_sitelib}/__pycache__/setuptools_behave*
%{python_sitelib}/behave-%{version}*-info
%changelog