Accepting request 962569 from devel:languages:python:pytest

- Update to 1.3:
  * Add a note on manual result printing to README - #50
  * Bump Python version to 3.6 - fix #51 
- Add patch remove-mock.patch:
  * Remove use of mock.

OBS-URL: https://build.opensuse.org/request/show/962569
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-console-scripts?expand=0&rev=9
This commit is contained in:
Dominique Leuenberger 2022-03-18 15:42:17 +00:00 committed by Git OBS Bridge
commit 0170430c87
5 changed files with 67 additions and 8 deletions

View File

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

View File

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

View File

@ -1,3 +1,12 @@
-------------------------------------------------------------------
Fri Mar 18 04:14:59 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 1.3:
* Add a note on manual result printing to README - #50
* Bump Python version to 3.6 - fix #51
- Add patch remove-mock.patch:
* Remove use of mock.
-------------------------------------------------------------------
Fri Dec 17 13:50:46 UTC 2021 - pgajdos@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package python-pytest-console-scripts
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -19,22 +19,21 @@
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define skip_python2 1
Name: python-pytest-console-scripts
Version: 1.2.1
Version: 1.3
Release: 0
Summary: Pytest plugin for testing console scripts
License: MIT
URL: https://github.com/kvas-it/pytest-console-scripts
Source: https://files.pythonhosted.org/packages/source/p/pytest-console-scripts/pytest-console-scripts-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#kvas-it/pytest-console-scripts#53
Patch0: remove-mock.patch
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-mock >= 2.0.0
Requires: python-pytest >= 4.0.0
BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module mock >= 2.0.0}
BuildRequires: %{python_module pytest >= 4.0.0}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module virtualenv >= 20}
# /SECTION

51
remove-mock.patch Normal file
View File

@ -0,0 +1,51 @@
From 0c2218a456372e64e8cf11afc8c65ce858670fc7 Mon Sep 17 00:00:00 2001
From: Steve Kowalik <steven@wedontsleep.org>
Date: Thu, 17 Mar 2022 15:54:59 +1100
Subject: [PATCH] Remove use of external mock
As of Python 3.3, mock has been included in the standard library, and in
fact, the test code makes use of that fact. However, the main plugin did
not, so remove its usage, and drop it from setup.py. Also clean up the
definition of StreamMock to boot.
---
pytest_console_scripts.py | 11 ++---------
setup.py | 2 +-
2 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/pytest_console_scripts.py b/pytest_console_scripts.py
index 7dca21d..822b8d6 100644
--- a/pytest_console_scripts.py
+++ b/pytest_console_scripts.py
@@ -9,17 +9,10 @@
import sys
import traceback
-import mock
+from unittest import mock
import pytest
-if sys.version_info.major == 2:
- # We can't use io.StringIO for mocking stdout/stderr in Python 2
- # because printing byte strings to it triggers unicode errors and
- # there's code in stdlib that does that (e.g. traceback module).
- import StringIO
- StreamMock = StringIO.StringIO
-else:
- StreamMock = io.StringIO
+StreamMock = io.StringIO
def pytest_addoption(parser):
diff --git a/setup.py b/setup.py
index 7bbbced..e0bdcf8 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ def read(fname):
long_description=read('README.md'),
long_description_content_type='text/markdown',
py_modules=['pytest_console_scripts'],
- install_requires=['pytest>=4.0.0', 'mock>=2.0.0'],
+ install_requires=['pytest>=4.0.0'],
python_requires='>=3.6',
setup_requires=['setuptools-scm'],
classifiers=[