Blob Blame History Raw
%global srcname behave
%global desc %{expand: \
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.}

# RHBZ #2179979
%undefine _py3_shebang_s

Name:           python-%{srcname}
Version:        1.2.6
Release:        %autorelease
Summary:        Tools for the behavior-driven development, Python style

License:        BSD-2-Clause
URL:  {srcname}

# This patch is backport of upstream commits solving
# Upstream issue:
Patch0:         0001-Backport-for-py38-fixes.patch
# This patch is backport of upstream commit solving issues with pytest 5.0 and newer
# Upstream issue:
Patch1:         0002-Tweak-tests-required-by-pytest-5.0.patch
# Invalid escape sequence warnings fixes
Patch2:		0003-invalid-escape-seq.patch
# RHBZ #2180467
Patch3:		0004-sphinx-extlinks.patch

BuildArch:      noarch

BuildRequires:	make
BuildRequires:  help2man
BuildRequires:	python3-devel
BuildRequires:	python3-hamcrest
BuildRequires:	python3-nose
BuildRequires:	python3-pytest
BuildRequires:	python3-sphinx
BuildRequires:	python3-sphinx-bootstrap-theme
Conflicts:	python2-behave < 1.2.6


%package -n python3-%{srcname}
Summary:        %{summary}

%description -n python3-%{srcname}

%package doc
Summary:        Documentation for %{name}

%description doc %{desc}

This package contains documentation in reST and HTML formats and some
brief feature-examples.

%autosetup -n %{srcname}-%{version} -p1

# setup command: use_2to3 is invalid
sed -i '/use_2to3/d'

# Use the standard library instead of a backport
sed -i -e 's/^import mock/from unittest import mock/' \
       -e 's/^from mock import /from unittest.mock import /' \
    test/*.py test/reporters/*.py tests/api/*.py tests/unit/*.py

sed -i '/mock/d' py.requirements/testing.txt
sed -i '/mock/d'
sed -i '/mock/d' tox.ini



make SPHINXBUILD=sphinx-build-3 html -C docs
rm -rf build/docs/html/.buildinfo

mkdir -p %{buildroot}%{_mandir}/man1

%pyproject_save_files %{srcname}

PYTHONPATH=%{buildroot}%{python3_sitelib} help2man \
  --no-info \
  --name="Run a number of feature tests with behave." \
  --output=%{srcname}.1 \

install -Dpm0644 %{srcname}.1 %{buildroot}%{_mandir}/man1/

%pytest -v

%files -n python3-%{srcname} -f %{pyproject_files}
%doc README.rst
%doc %{_mandir}/man1/%{srcname}.1*

%files doc
%license LICENSE
%doc README.rst build/docs/html