From 0bd5f42640df431b5c427527aadacc12c393c7cbec33c53bcb70e2d385afc90e Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 16 Aug 2020 17:41:34 +0000 Subject: [PATCH 1/2] Accepting request 827065 from home:jayvdb:py-submit Replace nose with pytest OBS-URL: https://build.opensuse.org/request/show/827065 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-proselint?expand=0&rev=19 --- python-proselint.changes | 6 ++++++ python-proselint.spec | 19 ++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/python-proselint.changes b/python-proselint.changes index fd3de22..6829062 100644 --- a/python-proselint.changes +++ b/python-proselint.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sun Aug 16 16:47:49 UTC 2020 - John Vandenberg + +- Replace unittest+nose with pytest +- Tidy spec + ------------------------------------------------------------------- Wed May 6 09:49:35 UTC 2020 - Matej Cepl diff --git a/python-proselint.spec b/python-proselint.spec index 5b743ff..dcc4aab 100644 --- a/python-proselint.spec +++ b/python-proselint.spec @@ -25,7 +25,7 @@ Summary: A linter for prose License: BSD-3-Clause URL: https://github.com/amperser/proselint Source: https://files.pythonhosted.org/packages/source/p/proselint/proselint-%{version}.tar.gz -# test_weasel_words_misc is empty in this release, and `setup.py test` doesnt recognise nose's SkipTest +# test_weasel_words_misc is empty in release v0.10.2, and contains nose.SkipTest Patch0: disable-empty-test.patch Patch1: test-use-sys-executable.patch BuildRequires: %{python_module setuptools} @@ -35,19 +35,19 @@ Requires: python-click Requires: python-dbm Requires: python-future Requires: python-six +Requires(post): update-alternatives +Requires(postun): update-alternatives BuildArch: noarch # SECTION test requirements BuildRequires: %{python_module click} BuildRequires: %{python_module dbm} BuildRequires: %{python_module future} -BuildRequires: %{python_module nose} +BuildRequires: %{python_module pytest} BuildRequires: %{python_module six} %if %{with python2} BuildRequires: python-mock %endif # /SECTION -Requires(post): update-alternatives -Requires(postun): update-alternatives %python_subpackages %description @@ -63,6 +63,7 @@ existing tools. %patch0 -p1 %patch1 -p1 sed -i -e '/^#!\//, 1d' proselint/*.py +sed -Ei 's/from nose (import SkipTest)/from unittest \1/' tests/test_gmeu/test_*.py %build %python_build @@ -72,15 +73,19 @@ sed -i -e '/^#!\//, 1d' proselint/*.py %python_clone -a %{buildroot}%{_bindir}/proselint %python_expand %fdupes %{buildroot}%{$python_sitelib} -%check -%python_exec setup.py test - %post %python_install_alternative proselint %postun %python_uninstall_alternative proselint +%check +mkdir ~/bin +export PATH=~/bin:$PATH +%{python_expand cp %{buildroot}%{_bindir}/proselint-%{$python_bin_suffix} ~/bin/proselint +PYTHONPATH=%{buildroot}%{$python_sitelib} $python -m pytest +} + %files %{python_files} %doc CHANGELOG.md README.md %license LICENSE.md From a6b0c5c38c2be65480f8c12560674e0ef0cba48c043303f927fc692798639b79 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Sun, 16 Aug 2020 17:50:48 +0000 Subject: [PATCH 2/2] - Replace the sed command from the previous commit with the proper patch remove_nose.patch and send it upstream (gh#amperser/proselint#1097). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-proselint?expand=0&rev=20 --- python-proselint.changes | 7 +++++++ python-proselint.spec | 8 +++++--- remove_nose.patch | 22 ++++++++++++++++++++++ 3 files changed, 34 insertions(+), 3 deletions(-) create mode 100644 remove_nose.patch diff --git a/python-proselint.changes b/python-proselint.changes index 6829062..8e7dab7 100644 --- a/python-proselint.changes +++ b/python-proselint.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Sun Aug 16 17:49:59 UTC 2020 - Matej Cepl + +- Replace the sed command from the previous commit with + the proper patch remove_nose.patch and send it upstream + (gh#amperser/proselint#1097). + ------------------------------------------------------------------- Sun Aug 16 16:47:49 UTC 2020 - John Vandenberg diff --git a/python-proselint.spec b/python-proselint.spec index dcc4aab..079c782 100644 --- a/python-proselint.spec +++ b/python-proselint.spec @@ -28,6 +28,9 @@ Source: https://files.pythonhosted.org/packages/source/p/proselint/prose # test_weasel_words_misc is empty in release v0.10.2, and contains nose.SkipTest Patch0: disable-empty-test.patch Patch1: test-use-sys-executable.patch +# PATCH-FEATURE-UPSTREAM remove_nose.patch gh#amperser/proselint#1097 mcepl@suse.com +# this patch makes things totally awesome +Patch2: remove_nose.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -60,10 +63,9 @@ existing tools. %prep %setup -q -n proselint-%{version} -%patch0 -p1 -%patch1 -p1 +%autopatch -p1 + sed -i -e '/^#!\//, 1d' proselint/*.py -sed -Ei 's/from nose (import SkipTest)/from unittest \1/' tests/test_gmeu/test_*.py %build %python_build diff --git a/remove_nose.patch b/remove_nose.patch new file mode 100644 index 0000000..b52f32f --- /dev/null +++ b/remove_nose.patch @@ -0,0 +1,22 @@ +--- a/tests/test_gmeu/test_a_A.py ++++ b/tests/test_gmeu/test_a_A.py +@@ -4,7 +4,7 @@ + """Test GMEU entry 'a', part A.""" + + from proselint.tools import assert_error +-from nose import SkipTest ++from unittest import SkipTest + + + def test_a_vs_an(): +--- a/tests/test_gmeu/test_a_B.py ++++ b/tests/test_gmeu/test_a_B.py +@@ -4,7 +4,7 @@ + """Test GMEU entry 'a', part B.""" + + from proselint.tools import assert_error +-from nose import SkipTest ++from unittest import SkipTest + + + def test_a_distributive():