From 57c5e3796333ec2e5c427081dee9feb6ea124c102fdf9590821e64507d84dec0 Mon Sep 17 00:00:00 2001 From: Benjamin Greiner Date: Thu, 27 Aug 2020 11:17:00 +0000 Subject: [PATCH] Accepting request 829965 from home:bnavigator:branches:devel:languages:python - enable hypothesmith integration tests - clarify test data source and multibuild strategy OBS-URL: https://build.opensuse.org/request/show/829965 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-isort?expand=0&rev=58 --- python-isort.changes | 6 ++++++ python-isort.spec | 25 +++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/python-isort.changes b/python-isort.changes index 8b58156..49540c2 100644 --- a/python-isort.changes +++ b/python-isort.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Aug 19 17:27:27 UTC 2020 - Benjamin Greiner + +- enable hypothesmith integration tests +- clarify test data source and multibuild strategy + ------------------------------------------------------------------- Wed Aug 19 04:17:27 UTC 2020 - Steve Kowalik diff --git a/python-isort.spec b/python-isort.spec index ebcb88c..cf2f964 100644 --- a/python-isort.spec +++ b/python-isort.spec @@ -32,8 +32,9 @@ Release: 0 Summary: A Python utility / library to sort Python imports License: MIT URL: https://timothycrosley.github.io/isort/ +# only PyPI archive contains setup.py Source: https://files.pythonhosted.org/packages/source/i/isort/isort-%{version}.tar.gz -# tests and test data are not packaged for PyPI, get them from git sources +# ... but 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 BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -41,6 +42,7 @@ BuildRequires: python-rpm-macros Requires: python-setuptools Requires(post): update-alternatives Requires(postun): update-alternatives +Recommends: python-hypothesmith Recommends: python-pip-api Recommends: python-pipreqs Recommends: python-requirementslib >= 1.5.4 @@ -50,7 +52,11 @@ BuildArch: noarch %if %{with test} BuildRequires: %{python_module black} BuildRequires: %{python_module hypothesis-auto} +BuildRequires: %{python_module hypothesmith} +# we cannot just use the source dir on test flavor because tests expect the +# installed entrypoint (through alternatives) BuildRequires: %{python_module isort = %{version}} +BuildRequires: %{python_module libcst} BuildRequires: %{python_module mock} BuildRequires: %{python_module pip-api} BuildRequires: %{python_module pipreqs} @@ -73,11 +79,14 @@ imports. It requires Python 3.6+ to run but supports formatting Python 2 code too. %prep -%if !%{with test} %setup -q -n isort-%{version} chmod -x LICENSE -%else -%setup -q -n isort-%{version} -T -b 1 +%if %{with test} +tar -x --strip-components=1 -f %{SOURCE1} \ + isort-%{version}/example_isort_formatting_plugin \ + isort-%{version}/example_shared_isort_profile \ + isort-%{version}/.isort.cfg \ + isort-%{version}/setup.cfg %endif %if !%{with test} @@ -98,9 +107,9 @@ chmod -x LICENSE %{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 + # don't enforce exact same environment as upstream's devel project rm poetry.lock - # no dependency download, we have it by BuildRequires + # no dependency download, we have them all by BuildRequires sed -i '/tool.poetry.dependencies/,/^$/ d' pyproject.toml poetry-%{$python_bin_suffix} install # append current dir, only use colon if not empty @@ -108,8 +117,7 @@ for exampledir in example_shared_isort_profile example_isort_formatting_plugin; popd done } -# no test_hypothesmith because no libcst because no pyre-check -%pytest -W "ignore::UserWarning" -W "ignore::DeprecationWarning" --ignore tests/test_hypothesmith.py +%pytest -W "ignore::UserWarning" -W "ignore::DeprecationWarning" %endif %if !%{with test} @@ -120,6 +128,7 @@ done %python_uninstall_alternative isort %files %{python_files} +%doc README.md %license LICENSE %python_alternative %{_bindir}/isort %{python_sitelib}/isort