[packages/python-exam] - new

qboosh qboosh at pld-linux.org
Wed Dec 13 21:30:02 CET 2023


commit 82e30713dfc8e8ccf72fce3fec30139fb5cd227a
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Dec 13 21:19:21 2023 +0100

    - new

 python-exam-mock.patch |  91 +++++++++++++++++++++++++++++++++++++
 python-exam.spec       | 121 +++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 212 insertions(+)
---
diff --git a/python-exam.spec b/python-exam.spec
new file mode 100644
index 0000000..2879f35
--- /dev/null
+++ b/python-exam.spec
@@ -0,0 +1,121 @@
+#
+# Conditional build:
+%bcond_without	tests	# unit tests
+%bcond_without	python2 # CPython 2.x module
+%bcond_without	python3 # CPython 3.x module
+
+Summary:	Helpers for better testing
+Summary(pl.UTF-8):	Moduł pomocniczy do lepszego testowania
+Name:		python-exam
+Version:	0.10.6
+Release:	1
+License:	MIT
+Group:		Libraries/Python
+#Source0Download: https://pypi.org/simple/exam/
+Source0:	https://files.pythonhosted.org/packages/source/e/exam/exam-%{version}.tar.gz
+# Source0-md5:	0bf84acc2427a8a3d58d13d7297ff84a
+Patch0:		%{name}-mock.patch
+URL:		https://pypi.org/project/exam/
+%if %{with python2}
+BuildRequires:	python-modules >= 1:2.6
+BuildRequires:	python-setuptools
+%if %{with tests}
+BuildRequires:	python-mock
+BuildRequires:	python-nose
+%endif
+%endif
+%if %{with python3}
+BuildRequires:	python3-modules >= 1:3.2
+BuildRequires:	python3-setuptools
+%if %{with tests}
+BuildRequires:	python3-nose
+%endif
+%endif
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.714
+Requires:	python-modules >= 1:2.6
+BuildArch:	noarch
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Exam is a Python toolkit for writing better tests. It aims to remove a
+lot of the boiler plate testing code one often writes, while still
+following Python conventions and adhering to the unit testing
+interface.
+
+%description -l pl.UTF-8
+Exam to zestaw narzędzi pythonowych do pisania lepszych testów. Celem
+jest usunięcie dużej części powtarzalnego kodu testującego, który
+zwykle się pisze przy zachowaniu zgodności z konwencjami Pythona i
+interfejsem testów jednostkowych.
+
+%package -n python3-exam
+Summary:	Helpers for better testing
+Summary(pl.UTF-8):	Moduł pomocniczy do lepszego testowania
+Group:		Libraries/Python
+Requires:	python3-modules >= 1:3.2
+
+%description -n python3-exam
+Exam is a Python toolkit for writing better tests. It aims to remove a
+lot of the boiler plate testing code one often writes, while still
+following Python conventions and adhering to the unit testing
+interface.
+
+%description -n python3-exam -l pl.UTF-8
+Exam to zestaw narzędzi pythonowych do pisania lepszych testów. Celem
+jest usunięcie dużej części powtarzalnego kodu testującego, który
+zwykle się pisze przy zachowaniu zgodności z konwencjami Pythona i
+interfejsem testów jednostkowych.
+
+%prep
+%setup -q -n exam-%{version}
+%patch0 -p1
+
+%build
+%if %{with python2}
+%py_build
+
+%if %{with tests}
+nosetests-%{py_ver} tests
+%endif
+%endif
+
+%if %{with python3}
+%py3_build
+
+%if %{with tests}
+nosetests-%{py3_ver} tests
+%endif
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%py_install
+
+%py_postclean
+%endif
+
+%if %{with python3}
+%py3_install
+%endif
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%if %{with python2}
+%files
+%defattr(644,root,root,755)
+%doc README.rst
+%{py_sitescriptdir}/exam
+%{py_sitescriptdir}/exam-%{version}-py*.egg-info
+%endif
+
+%if %{with python3}
+%files -n python3-exam
+%defattr(644,root,root,755)
+%doc README.rst
+%{py3_sitescriptdir}/exam
+%{py3_sitescriptdir}/exam-%{version}-py*.egg-info
+%endif
diff --git a/python-exam-mock.patch b/python-exam-mock.patch
new file mode 100644
index 0000000..c6a246c
--- /dev/null
+++ b/python-exam-mock.patch
@@ -0,0 +1,91 @@
+--- exam-0.10.6/setup.py.orig	2016-05-26 23:07:32.000000000 +0200
++++ exam-0.10.6/setup.py	2023-12-12 21:34:16.445079137 +0100
+@@ -8,7 +8,10 @@ try:
+ except ImportError:
+     pass
+ 
+-install_requires = ['mock']
++install_requires = []
++if sys.version_info < (3, 0):
++    install_requires.append('mock')
++
+ lint_requires = ['pep8', 'pyflakes']
+ tests_require = ['nose']
+ 
+--- exam-0.10.6/exam/decorators.py.orig	2016-05-26 23:07:32.000000000 +0200
++++ exam-0.10.6/exam/decorators.py	2023-12-12 21:34:47.028246787 +0100
+@@ -1,6 +1,9 @@
+ from __future__ import absolute_import
+ 
+-from mock import patch
++try:
++    from unittest.mock import patch
++except ImportError:
++    from mock import patch
+ from functools import partial, wraps
+ import types
+ 
+--- exam-0.10.6/exam/helpers.py.orig	2016-05-26 23:07:32.000000000 +0200
++++ exam-0.10.6/exam/helpers.py	2023-12-12 21:35:27.308028573 +0100
+@@ -4,7 +4,10 @@ import shutil
+ import os
+ import functools
+ 
+-from mock import MagicMock, patch, call
++try:
++    from unittest.mock import MagicMock, patch, call
++except ImportError:
++    from mock import MagicMock, patch, call
+ 
+ 
+ def rm_f(path):
+--- exam-0.10.6/exam/mock.py.orig	2016-05-26 23:07:32.000000000 +0200
++++ exam-0.10.6/exam/mock.py	2023-12-12 21:36:00.807847089 +0100
+@@ -1,7 +1,11 @@
+ from __future__ import absolute_import
+ 
+-from mock import Mock as BaseMock
+-from mock import call
++try:
++    from unittest.mock import Mock as BaseMock
++    from unittest.mock import call
++except ImportError:
++    from mock import Mock as BaseMock
++    from mock import call
+ 
+ 
+ class Mock(BaseMock):
+--- exam-0.10.6/tests/test_cases.py.orig	2016-05-26 23:07:32.000000000 +0200
++++ exam-0.10.6/tests/test_cases.py	2023-12-13 21:14:40.973378253 +0100
+@@ -1,4 +1,7 @@
+-from mock import sentinel
++try:
++    from unittest.mock import sentinel
++except ImportError:
++    from mock import sentinel
+ from tests import TestCase
+ 
+ from exam.decorators import before, after, around, patcher
+--- exam-0.10.6/tests/test_helpers.py.orig	2016-05-26 23:07:32.000000000 +0200
++++ exam-0.10.6/tests/test_helpers.py	2023-12-13 21:15:08.059898179 +0100
+@@ -1,5 +1,8 @@
+ from tests import TestCase
+-from mock import patch, Mock, sentinel
++try:
++    from unittest.mock import patch, Mock, sentinel
++except ImportError:
++    from mock import patch, Mock, sentinel
+ 
+ from exam.helpers import intercept, rm_f, track, mock_import, call, effect
+ from exam.decorators import fixture
+--- exam-0.10.6/tests/test_objects.py.orig	2016-05-26 23:07:32.000000000 +0200
++++ exam-0.10.6/tests/test_objects.py	2023-12-13 21:15:30.263111227 +0100
+@@ -1,4 +1,7 @@
+-from mock import sentinel
++try:
++    from unittest.mock import sentinel
++except ImportError:
++    from mock import sentinel
+ from tests import TestCase
+ 
+ from exam.objects import always, noop
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/python-exam.git/commitdiff/82e30713dfc8e8ccf72fce3fec30139fb5cd227a



More information about the pld-cvs-commit mailing list