From 13d276717d61687be408cd29be6b9e555e610b524139cea3d8245f6cb5a914d4 Mon Sep 17 00:00:00 2001 From: Daniel Garcia Date: Wed, 16 Nov 2022 17:26:11 +0000 Subject: [PATCH] - Add remove-six.patch to remove six dependency, gh#datadriventests/ddt#110 - Remove python_module macro definition - More specific python_sitelib in %files OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-ddt?expand=0&rev=38 --- python-ddt.changes | 7 +++++ python-ddt.spec | 11 +++---- remove-six.patch | 75 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 5 deletions(-) create mode 100644 remove-six.patch diff --git a/python-ddt.changes b/python-ddt.changes index 8ccd9bc..e74d992 100644 --- a/python-ddt.changes +++ b/python-ddt.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Wed Nov 16 17:20:57 UTC 2022 - Daniel Garcia + +- Add remove-six.patch to remove six dependency +- Remove python_module macro definition +- More specific python_sitelib in %files + ------------------------------------------------------------------- Mon Sep 26 10:38:04 UTC 2022 - Dirk Müller diff --git a/python-ddt.spec b/python-ddt.spec index 5f11b0e..b72d8c6 100644 --- a/python-ddt.spec +++ b/python-ddt.spec @@ -16,7 +16,6 @@ # -%{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without python2 Name: python-ddt Version: 1.6.0 @@ -25,8 +24,9 @@ Summary: Data-Driven/Decorated Tests License: MIT URL: https://github.com/txels/ddt Source: https://files.pythonhosted.org/packages/source/d/ddt/ddt-%{version}.tar.gz +# PATCH-FIX-UPSTREAM remove-six.patch gh#datadriventests/ddt#110 +Patch0: remove-six.patch BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module six} BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch @@ -44,8 +44,7 @@ BuildRequires: python2-mock A library to multiply test cases. %prep -%setup -q -n ddt-%{version} -%autopatch -p1 +%autosetup -p1 -n ddt-%{version} %build %python_build @@ -60,6 +59,8 @@ A library to multiply test cases. %files %{python_files} %doc CONTRIBUTING.md README.md %license LICENSE.md -%{python_sitelib}/* +%{python_sitelib}/ddt.py +%{python_sitelib}/ddt-%{version}*-info +%pycache_only %{python_sitelib}/__pycache__ %changelog diff --git a/remove-six.patch b/remove-six.patch new file mode 100644 index 0000000..1cf180f --- /dev/null +++ b/remove-six.patch @@ -0,0 +1,75 @@ +Index: ddt-1.6.0/test/test_functional.py +=================================================================== +--- ddt-1.6.0.orig/test/test_functional.py ++++ ddt-1.6.0/test/test_functional.py +@@ -1,8 +1,8 @@ + import os + import json ++import sys + from sys import modules + import pytest +-import six + + try: + from unittest import mock +@@ -444,35 +444,35 @@ def test_ddt_data_doc_attribute(): + assert getattr(getattr(ddt_mytest, 'second_test_3'), '__doc__') is None + + +-def test_ddt_data_unicode(): ++@pytest.mark.skipif(sys.version_info.major > 2, reason='Python2 only test') ++def test_ddt_data_unicode_py2(): + """ + Test that unicode strings are converted to function names correctly + """ +- # We test unicode support separately for python 2 and 3 +- +- if six.PY2: ++ @ddt ++ class Mytest(object): ++ @data(u'ascii', u'non-ascii-\N{SNOWMAN}', {u'\N{SNOWMAN}': 'data'}) ++ def test_hello(self, val): ++ pass ++ ++ assert getattr(Mytest, 'test_hello_1_ascii') is not None ++ assert getattr(Mytest, 'test_hello_2_non_ascii__u2603') is not None ++ assert getattr(Mytest, 'test_hello_3') is not None + +- @ddt +- class Mytest(object): +- @data(u'ascii', u'non-ascii-\N{SNOWMAN}', {u'\N{SNOWMAN}': 'data'}) +- def test_hello(self, val): +- pass +- +- assert getattr(Mytest, 'test_hello_1_ascii') is not None +- assert getattr(Mytest, 'test_hello_2_non_ascii__u2603') is not None +- assert getattr(Mytest, 'test_hello_3') is not None +- +- elif six.PY3: +- +- @ddt +- class Mytest(object): +- @data('ascii', 'non-ascii-\N{SNOWMAN}', {'\N{SNOWMAN}': 'data'}) +- def test_hello(self, val): +- pass +- +- assert getattr(Mytest, 'test_hello_1_ascii') is not None +- assert getattr(Mytest, 'test_hello_2_non_ascii__') is not None +- assert getattr(Mytest, 'test_hello_3') is not None ++@pytest.mark.skipif(sys.version_info.major < 3, reason='Python3 only test') ++def test_ddt_data_unicode_py3(): ++ """ ++ Test that unicode strings are converted to function names correctly ++ """ ++ @ddt ++ class Mytest(object): ++ @data('ascii', 'non-ascii-\N{SNOWMAN}', {'\N{SNOWMAN}': 'data'}) ++ def test_hello(self, val): ++ pass ++ ++ assert getattr(Mytest, 'test_hello_1_ascii') is not None ++ assert getattr(Mytest, 'test_hello_2_non_ascii__') is not None ++ assert getattr(Mytest, 'test_hello_3') is not None + + + def test_ddt_data_object():