14
0

Accepting request 832684 from home:mnhauke

- Use a more meaningful description
- Add patch:
  * python-smpplib-use-unittest-mock.patch
    Use 'unitest.mock' instead of the external mock package

OBS-URL: https://build.opensuse.org/request/show/832684
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-smpplib?expand=0&rev=2
This commit is contained in:
Tomáš Chvátal
2020-09-07 12:29:19 +00:00
committed by Git OBS Bridge
parent 2a8585fc09
commit b0ed756178
3 changed files with 75 additions and 5 deletions

View File

@@ -0,0 +1,56 @@
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 6ae73bb..a5b583a 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -25,7 +25,7 @@ jobs:
virtualenv -p "$(which python || which pypy)" ./venv
)
. venv/bin/activate
- pip install pytest mock
+ pip install pytest
- run:
name: Install project
command: |
diff --git a/setup.py b/setup.py
index 8940285..ea154e1 100644
--- a/setup.py
+++ b/setup.py
@@ -11,7 +11,7 @@ setup(
long_description_content_type='text/markdown',
packages=find_packages(),
install_requires=['six'],
- tests_require=['pytest', 'mock', 'tox'],
+ tests_require=['pytest', 'tox'],
zip_safe=True,
classifiers=[
'Development Status :: 5 - Production/Stable',
diff --git a/tests/test_gsm.py b/tests/test_gsm.py
index b6641fd..7760dc4 100644
--- a/tests/test_gsm.py
+++ b/tests/test_gsm.py
@@ -1,6 +1,6 @@
# -*- coding: utf8 -*-
-import mock
+from unittest.mock import patch
from pytest import mark, raises
from smpplib import consts
@@ -39,7 +39,7 @@ def test_make_parts_single(plaintext, encoding, expected_parts, expected_encodin
]),
])
def test_make_parts_multiple(plaintext, expected):
- with mock.patch('random.randint') as randint:
+ with patch('random.randint') as randint:
randint.return_value = 0x42
assert make_parts(plaintext) == (expected, consts.SMPP_ENCODING_DEFAULT, consts.SMPP_GSMFEAT_UDHI)
@@ -49,7 +49,7 @@ def test_make_parts_multiple(plaintext, expected):
(b'12345', 2, [b'\x05\x00\x03\x42\x03\x0112', b'\x05\x00\x03\x42\x03\x0234', b'\x05\x00\x03\x42\x03\x035']),
])
def test_make_parts_encoded(encoded_text, part_size, expected):
- with mock.patch('random.randint') as randint:
+ with patch('random.randint') as randint:
randint.return_value = 0x42
assert make_parts_encoded(encoded_text, part_size) == expected

View File

@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Mon Sep 7 07:26:54 UTC 2020 - Martin Hauke <mardnh@gmx.de>
- Use a more meaningful description
- Add patch:
* python-smpplib-use-unittest-mock.patch
Use 'unitest.mock' instead of the external mock package
-------------------------------------------------------------------
Mon Sep 7 05:49:43 UTC 2020 - Martin Hauke <mardnh@gmx.de>

View File

@@ -1,6 +1,7 @@
#
# spec file for package python-smpplib
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2016-2020, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
@@ -12,23 +13,24 @@
# 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/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name: python-smpplib
Version: 2.1.0
Release: 0
Summary: SMPP library for Python
License: LGPL-2.0
License: LGPL-2.0-only
Group: Development/Languages/Python
URL: https://pypi.org/project/smpplib/
#Git-Clone: https://github.com/python-smpplib/python-smpplib.git
Source: https://github.com/python-smpplib/python-smpplib/archive/%{version}.tar.gz#/smpplib-%{version}.tar.gz
BuildRequires: python-rpm-macros
Patch0: python-smpplib-use-unittest-mock.patch
BuildRequires: %{python_module setuptools}
BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module mock}
BuildRequires: %{python_module pytest}
# /SECTION
BuildRequires: fdupes
@@ -37,10 +39,14 @@ BuildArch: noarch
%python_subpackages
%description
SMPP library for Python.
SMPP is the Short Message Peer-to-Peer protocol for conveying SMS
operations.
Python-smpplib is a python based SMPP 3.4 client library that
allows you to send and receive SMS to an SMS gateway or SMSC.
%prep
%setup -q -n python-smpplib-%{version}
%patch0 -p1
%build
%python_build