#6 Enable testing with pytest and use the github tarball
Merged 3 years ago by apevec. Opened 3 years ago by cstratak.
rpms/ cstratak/python-memcached rawhide  into  rawhide

file modified
+1
@@ -3,3 +3,4 @@ 

  /python-memcached-1.54.tar.gz

  /python-memcached-1.58.tar.gz

  /python-memcached-1.59.tar.gz

+ /1.59.tar.gz

file modified
+14 -4
@@ -1,19 +1,19 @@ 

  Name:           python-memcached

  Version:        1.59

- Release:        2%{?dist}

+ Release:        3%{?dist}

  Summary:        A Python memcached client library

  

  License:        Python

  URL:            https://github.com/linsomniac/python-memcached

- Source0:        https://files.pythonhosted.org/packages/source/p/%{name}/%{name}-%{version}.tar.gz

+ Source0:        https://github.com/linsomniac/python-memcached/archive/%{version}.tar.gz

I'd normally use: %{url}/archive/%{version}/%{name}-%{version}.tar.gz but this works as well.

Keeping it in-line with the URL. I can either change both, or none, I don't like seeing those different :P

I am afraid I don't understand. My suggestion changes the filename to contain the name + uses the %{url} macro. Which bit are you referring to?

Apologies for not explaining properly. It's more of a visual thing preference:

URL:            https://github.com/linsomniac/python-memcached
Source0:        https://github.com/linsomniac/python-memcached/archive/%{version}.tar.gz

vs

URL:            https://github.com/linsomniac/python-memcached
Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz

However since this is obviously a personal preference and not my package, I can modify it accordingly.

  

  BuildArch:      noarch

  BuildRequires:  python3-devel

  BuildRequires:  python3-setuptools

  BuildRequires:  python3-six

- BuildRequires:  python3-nose

  # Required for running test suite

  BuildRequires:  %{_bindir}/memcached

+ BuildRequires:  python3-pytest

  

  %global _description\

  This software is a 100% Python interface to the memcached memory cache\
@@ -34,6 +34,13 @@ 

  %prep

  %autosetup -n %{name}-%{version}

  

+ # Fix version information

+ sed -i 's/1\.58/1\.59/' memcache.py

What about: 's/1\.58/%{version}/' instead? Should last if the problem is not fixed upstream in next version.

It's fixed (but not released)

ack

+ 

+ # Use the standard library mock instead of the external one

+ sed -i -e 's/^import mock/from unittest import mock/' \

+     tests/test_memcache.py

Could you please bring this to upstream as well? However they seem dormant a bit.

+ 

  

  %build

  %py3_build
@@ -47,7 +54,7 @@ 

  pidfile=$(mktemp)

  memcached -d -P $pidfile

  

- %{__python3} -m nose

+ %pytest

  

  kill $(cat $pidfile)

  
@@ -61,6 +68,9 @@ 

  

  

  %changelog

+ * Mon Feb 08 2021 Charalampos Stratakis <cstratak@redhat.com> - 1.59-3

+ - Enable testing with pytest and use the github tarball

+ 

  * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.59-2

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

  

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (python-memcached-1.59.tar.gz) = a25cbb9efb3babe85e1523bdabfe4644b93b3a6a7268787a3928f724f833ce0eea7d2ef676d1b7f894cdfe293129975b35cb46ec553c92810dbc18013bfabece

+ SHA512 (1.59.tar.gz) = d7ff45a329f2a9bf97fdc7c0268c2c67046c3501270fcf03578b955c2da35904d7bdecd4239924d390797ddff8f4cc69fc5743f4d4f663cdb9f2f8c7e8159512

The change is due to the tests not being present at the pypi tarball.

Also change from nose to pytest and use the stdlib mock libraby.

Minor fix for the version information.

What about: 's/1\.58/%{version}/' instead? Should last if the problem is not fixed upstream in next version.

I'd normally use: %{url}/archive/%{version}/%{name}-%{version}.tar.gz but this works as well.

+ /usr/bin/pytest
============================= test session starts ==============================
platform linux -- Python 3.9.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /builddir/build/BUILD/python-memcached-1.59
collected 23 items
tests/test_memcache.py ......................                            [ 95%]
tests/test_setmulti.py .                                                 [100%]
=============================== warnings summary ===============================
memcache.py:110
  /builddir/build/BUILD/python-memcached-1.59/memcache.py:110: DeprecationWarning: invalid escape sequence \ 
    """Object representing a pool of memcache servers.
memcache.py:1303
  /builddir/build/BUILD/python-memcached-1.59/memcache.py:1303: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if key is '':
memcache.py:1304
  /builddir/build/BUILD/python-memcached-1.59/memcache.py:1304: SyntaxWarning: "is" with a literal. Did you mean "=="?
    if key_extra_len is 0:
-- Docs: https://docs.pytest.org/en/stable/warnings.html
======================== 23 passed, 3 warnings in 0.25s ========================

Looks like the tests indeed run, so this is an overall improvement, thanks!

+1. Let me know if you want me to merge / build.

Keeping it in-line with the URL. I can either change both, or none, I don't like seeing those different :P

I am afraid I don't understand. My suggestion changes the filename to contain the name + uses the %{url} macro. Which bit are you referring to?

It's fixed (but not released)

ack

Could you please bring this to upstream as well? However they seem dormant a bit.

Apologies for not explaining properly. It's more of a visual thing preference:

URL:            https://github.com/linsomniac/python-memcached
Source0:        https://github.com/linsomniac/python-memcached/archive/%{version}.tar.gz

vs

URL:            https://github.com/linsomniac/python-memcached
Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz

However since this is obviously a personal preference and not my package, I can modify it accordingly.

Not "my" package either, don't worry about it.

lgtm - and agree re. dormant upstream, so few hacks in .spec is fine

Pull-Request has been merged by apevec

3 years ago