Accepting request 823224 from home:bnavigator:branches:devel:languages:python

- use poetry to install example projects. fixes the two remaining
  test issues

needs SR 823222
and SR 823223

OBS-URL: https://build.opensuse.org/request/show/823224
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-isort?expand=0&rev=49
This commit is contained in:
Benjamin Greiner 2020-07-28 20:21:49 +00:00 committed by Git OBS Bridge
parent b1a682d120
commit 5fdf9d6ac0
2 changed files with 27 additions and 3 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jul 28 20:09:25 UTC 2020 - Benjamin Greiner <code@bnavigator.de>
- use poetry to install example projects. fixes the two remaining
test issues
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jul 28 19:01:37 UTC 2020 - Sebastian Wagner <sebix+novell.com@sebix.at> Tue Jul 28 19:01:37 UTC 2020 - Sebastian Wagner <sebix+novell.com@sebix.at>

View File

@ -33,7 +33,7 @@ Summary: A Python utility / library to sort Python imports
License: MIT License: MIT
URL: https://timothycrosley.github.io/isort/ URL: https://timothycrosley.github.io/isort/
Source: https://files.pythonhosted.org/packages/source/i/isort/isort-%{version}.tar.gz Source: https://files.pythonhosted.org/packages/source/i/isort/isort-%{version}.tar.gz
# tests are not packaged for PyPI, get them from git sources # tests and test data are not packaged for PyPI, get them from git sources
Source1: https://github.com/timothycrosley/isort/archive/%{version}.tar.gz#/isort-%{version}-gh.tar.gz Source1: https://github.com/timothycrosley/isort/archive/%{version}.tar.gz#/isort-%{version}-gh.tar.gz
BuildRequires: %{python_module setuptools} BuildRequires: %{python_module setuptools}
BuildRequires: fdupes BuildRequires: fdupes
@ -45,13 +45,16 @@ Recommends: python-pip-api
Recommends: python-pipreqs Recommends: python-pipreqs
Recommends: python-requirementslib >= 1.5.4 Recommends: python-requirementslib >= 1.5.4
Recommends: python-tomlkit Recommends: python-tomlkit
Suggests: git
BuildArch: noarch BuildArch: noarch
%if %{with test} %if %{with test}
BuildRequires: %{python_module black}
BuildRequires: %{python_module hypothesis-auto} BuildRequires: %{python_module hypothesis-auto}
BuildRequires: %{python_module isort = %{version}} BuildRequires: %{python_module isort = %{version}}
BuildRequires: %{python_module mock} BuildRequires: %{python_module mock}
BuildRequires: %{python_module pip-api} BuildRequires: %{python_module pip-api}
BuildRequires: %{python_module pipreqs} BuildRequires: %{python_module pipreqs}
BuildRequires: %{python_module poetry}
BuildRequires: %{python_module pylama} BuildRequires: %{python_module pylama}
BuildRequires: %{python_module pytest} BuildRequires: %{python_module pytest}
BuildRequires: %{python_module requirementslib >= 1.5.4} BuildRequires: %{python_module requirementslib >= 1.5.4}
@ -74,13 +77,15 @@ too.
%setup -q -n isort-%{version} %setup -q -n isort-%{version}
chmod -x LICENSE chmod -x LICENSE
%else %else
%setup -q -n isort-%{version} -b 1 %setup -q -n isort-%{version} -T -b 1
%endif %endif
%if !%{with test} %if !%{with test}
%build %build
%python_build %python_build
%endif
%if !%{with test}
%install %install
%python_install %python_install
%python_expand rm -r %{buildroot}%{$python_sitelib}/tests/ %python_expand rm -r %{buildroot}%{$python_sitelib}/tests/
@ -90,7 +95,20 @@ chmod -x LICENSE
%if %{with test} %if %{with test}
%check %check
%pytest -v -W "ignore::UserWarning" -W "ignore::DeprecationWarning" %{python_expand # create egg-info for example projects
for exampledir in example_shared_isort_profile example_isort_formatting_plugin; do
pushd $exampledir
# no exact environment as upstreams devel project
rm poetry.lock
# no dependency download, we have it by BuildRequires
sed -i '/tool.poetry.dependencies/,/^$/ d' pyproject.toml
poetry-%{$python_bin_suffix} install
# append current dir, only use colon if not empty
export PYTHONPATH="${PYTHONPATH:+$PYTHONPATH:}$(pwd)"
popd
done
}
%pytest -v -W "ignore::UserWarning" -W "ignore::DeprecationWarning"
%endif %endif
%if !%{with test} %if !%{with test}