From d2149eee40d488b2aadd0a13ce00dbcb8495883ad9370375b6ed1556aa2d8856 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 9 Sep 2019 07:15:10 +0000 Subject: [PATCH] Accepting request 728151 from home:jayvdb:py-tri Independent testing tool, with pytest plugin OBS-URL: https://build.opensuse.org/request/show/728151 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-mutmut?expand=0&rev=1 --- .gitattributes | 23 +++++++++++ .gitignore | 1 + merged_4405bafe.patch | 22 ++++++++++ mutmut-1.5.1.tar.gz | 3 ++ pr_134.patch | 23 +++++++++++ pr_148.patch | 62 +++++++++++++++++++++++++++++ python-mutmut.changes | 4 ++ python-mutmut.spec | 93 +++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 231 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 merged_4405bafe.patch create mode 100644 mutmut-1.5.1.tar.gz create mode 100644 pr_134.patch create mode 100644 pr_148.patch create mode 100644 python-mutmut.changes create mode 100644 python-mutmut.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/merged_4405bafe.patch b/merged_4405bafe.patch new file mode 100644 index 0000000..2fc586c --- /dev/null +++ b/merged_4405bafe.patch @@ -0,0 +1,22 @@ +From 4405bafe48981e63c2b560e28f6e85ed0e601f23 Mon Sep 17 00:00:00 2001 +From: Nathan Klapstein +Date: Thu, 22 Aug 2019 18:07:48 -0400 +Subject: [PATCH] fixing issue with whatthepatch 0.0.6 + +--- + mutmut/__main__.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mutmut/__main__.py b/mutmut/__main__.py +index 5066393..396767a 100644 +--- a/mutmut/__main__.py ++++ b/mutmut/__main__.py +@@ -635,7 +635,7 @@ def read_patch_data(patch_file_path): + diffs = whatthepatch.parse_patch(f.read()) + + return { +- diff.header.new_path: {line_number for old_line_number, line_number, text in diff.changes if old_line_number is None} ++ diff.header.new_path: {line_number for old_line_number, line_number, text, *_ in diff.changes if old_line_number is None} + for diff in diffs + } + diff --git a/mutmut-1.5.1.tar.gz b/mutmut-1.5.1.tar.gz new file mode 100644 index 0000000..ae22b4f --- /dev/null +++ b/mutmut-1.5.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b9895f93c456f4a6b8f0d597ccbe647f3d36a0a86415494c25ffc42894e3c4ae +size 41691 diff --git a/pr_134.patch b/pr_134.patch new file mode 100644 index 0000000..39573f7 --- /dev/null +++ b/pr_134.patch @@ -0,0 +1,23 @@ +From bd3866316949f8ba7162e0292be0776d6f51cf50 Mon Sep 17 00:00:00 2001 +From: Maxime Lapointe +Date: Tue, 23 Jul 2019 08:55:15 -0400 +Subject: [PATCH] Use sys.executable as default python executable + +It's more likely to be the correct Python executable in case where someone specified the executable when running mutmut. +--- + mutmut/__main__.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/mutmut/__main__.py b/mutmut/__main__.py +index 1f86048..d300a23 100644 +--- a/mutmut/__main__.py ++++ b/mutmut/__main__.py +@@ -193,7 +193,7 @@ def print_progress(self): + @click.option('--post-mutation') + @config_from_setup_cfg( + dict_synonyms='', +- runner='python -m pytest -x', ++ runner='"' + sys.executable + '" -m pytest -x', + tests_dir=DEFAULT_TESTS_DIR, + pre_mutation=None, + post_mutation=None, diff --git a/pr_148.patch b/pr_148.patch new file mode 100644 index 0000000..418847b --- /dev/null +++ b/pr_148.patch @@ -0,0 +1,62 @@ +From b963cf66e26599fa7ac4a1646dd1be5704624673 Mon Sep 17 00:00:00 2001 +From: John Vandenberg +Date: Wed, 4 Sep 2019 12:37:28 +0700 +Subject: [PATCH] test_main: Use sys.executable + +Avoids test failures related to multiple pythons, +especially when the `python` executable is Python 2. +--- + tests/test_main.py | 16 ++++++++++++---- + 1 file changed, 12 insertions(+), 4 deletions(-) + +Index: mutmut-1.5.1/tests/test_main.py +=================================================================== +--- mutmut-1.5.1.orig/tests/test_main.py ++++ mutmut-1.5.1/tests/test_main.py +@@ -20,6 +20,7 @@ try: + except ImportError: + from mock import MagicMock, call + ++PYTHON = '"{}"'.format(sys.executable) + + file_to_mutate_lines = [ + "def foo(a, b):", +@@ -168,7 +169,10 @@ def test_python_source_files__with_paths + def test_popen_streaming_output_timeout(): + start = time() + with pytest.raises(TimeoutError): +- popen_streaming_output('python -c "import time; time.sleep(4)"', lambda line: line, timeout=0.1) ++ popen_streaming_output( ++ PYTHON + ' -c "import time; time.sleep(4)"', ++ lambda line: line, timeout=0.1, ++ ) + + assert (time() - start) < 3 + +@@ -176,20 +180,23 @@ def test_popen_streaming_output_timeout( + def test_popen_streaming_output_stream(): + mock = MagicMock() + popen_streaming_output( +- 'python -c "print(\'first\'); print(\'second\')"', ++ PYTHON + ' -c "print(\'first\'); print(\'second\')"', + callback=mock + ) + mock.assert_has_calls([call('first'), call('second')]) + + mock = MagicMock() + popen_streaming_output( +- 'python -c "import time; print(\'first\'); time.sleep(1); print(\'second\'); print(\'third\')"', ++ PYTHON + ++ ' -c "import time; print(\'first\'); time.sleep(1); print(\'second\'); print(\'third\')"', + callback=mock + ) + mock.assert_has_calls([call('first'), call('second'), call('third')]) + + mock = MagicMock() +- popen_streaming_output('python -c "exit(0);"', callback=mock) ++ popen_streaming_output( ++ PYTHON + ' -c "exit(0);"', ++ callback=mock) + mock.assert_not_called() + + diff --git a/python-mutmut.changes b/python-mutmut.changes new file mode 100644 index 0000000..75a9eea --- /dev/null +++ b/python-mutmut.changes @@ -0,0 +1,4 @@ +------------------------------------------------------------------- +Wed Aug 7 03:15:06 AM UTC 2019 - John Vandenberg + +- Initial spec for v1.5.1 diff --git a/python-mutmut.spec b/python-mutmut.spec new file mode 100644 index 0000000..71e0472 --- /dev/null +++ b/python-mutmut.spec @@ -0,0 +1,93 @@ +# +# spec file for package python-mutmut +# +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# +# 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 http://bugs.opensuse.org/ + + +%{?!python_module:%define python_module() python-%{**} python3-%{**}} +# tri.declarative is Python 3 only +%define skip_python2 1 +Name: python-mutmut +Version: 1.5.1 +Release: 0 +License: BSD-3-Clause +Summary: Python mutation testing +Url: https://github.com/boxed/mutmut +Group: Development/Languages/Python +Source: https://files.pythonhosted.org/packages/source/m/mutmut/mutmut-%{version}.tar.gz +Patch0: https://github.com/boxed/mutmut/commit/merged_4405bafe.patch +Patch1: https://github.com/boxed/mutmut/commit/bd386631.patch#/pr_134.patch +# Backport of https://github.com/boxed/mutmut/pull/148 +Patch2: pr_148.patch +BuildRequires: python-rpm-macros +BuildRequires: %{python_module setuptools} +# SECTION test requirements +BuildRequires: %{python_module click} +BuildRequires: %{python_module glob2} +BuildRequires: %{python_module junit-xml >= 1.8} +BuildRequires: %{python_module parso} +BuildRequires: %{python_module pony} +BuildRequires: %{python_module tri.declarative >= 3.0.0} +BuildRequires: %{python_module coverage} +BuildRequires: %{python_module mock >= 2.0.0} +BuildRequires: %{python_module pytest >= 2.8.7} +BuildRequires: %{python_module pytest-cov} +BuildRequires: %{python_module whatthepatch >= 0.0.5} +BuildRequires: patch +BuildRequires: ed +# /SECTION +BuildRequires: fdupes +Requires: python-click +Requires: python-glob2 +Requires: python-junit-xml >= 1.8 +Requires: python-parso +Requires: python-pony +Requires: python-tri.declarative >= 3.0.0 +Recommends: python-coverage +Recommends: python-pytest +Suggests: python-pytest-cov +BuildArch: noarch + +%python_subpackages + +%description +Python mutation testing. + +%prep +%setup -q -n mutmut-%{version} +%autopatch -p1 + +sed -i 's/==/>=/' *requirements.txt +# Remove maximum pins any anything that follows +sed -Ei 's/,?<=?.*$//' test_requirements.txt + +sed -i '1{/^#!/d}' mutmut/__main__.py + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%python_exec setup.py test + +%files %{python_files} +%doc README.rst +%license LICENSE +%python3_only %{_bindir}/mutmut +%{python_sitelib}/* + +%changelog