1
0
forked from pool/python-mutmut

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
This commit is contained in:
Tomáš Chvátal 2019-09-09 07:15:10 +00:00 committed by Git OBS Bridge
commit d2149eee40
8 changed files with 231 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

22
merged_4405bafe.patch Normal file
View File

@ -0,0 +1,22 @@
From 4405bafe48981e63c2b560e28f6e85ed0e601f23 Mon Sep 17 00:00:00 2001
From: Nathan Klapstein <nklapste@ualberta.ca>
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
}

3
mutmut-1.5.1.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b9895f93c456f4a6b8f0d597ccbe647f3d36a0a86415494c25ffc42894e3c4ae
size 41691

23
pr_134.patch Normal file
View File

@ -0,0 +1,23 @@
From bd3866316949f8ba7162e0292be0776d6f51cf50 Mon Sep 17 00:00:00 2001
From: Maxime Lapointe <hunter_spawn@hotmail.com>
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,

62
pr_148.patch Normal file
View File

@ -0,0 +1,62 @@
From b963cf66e26599fa7ac4a1646dd1be5704624673 Mon Sep 17 00:00:00 2001
From: John Vandenberg <jayvdb@gmail.com>
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()

4
python-mutmut.changes Normal file
View File

@ -0,0 +1,4 @@
-------------------------------------------------------------------
Wed Aug 7 03:15:06 AM UTC 2019 - John Vandenberg <jayvdb@gmail.com>
- Initial spec for v1.5.1

93
python-mutmut.spec Normal file
View File

@ -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