]> git.pld-linux.org Git - packages/python-mock.git/blame - python-mock.spec
- rebuild with python 3.8
[packages/python-mock.git] / python-mock.spec
CommitLineData
8458ad63 1#
a9c81cc9 2# Conditional build:
0d282d8d 3%bcond_without doc # Sphinx documentation
a9c81cc9
JK
4%bcond_without python2 # CPython 2.x module
5%bcond_without python3 # CPython 3.x module
0d282d8d 6%bcond_with tests # test target
a9c81cc9 7
deb91033 8%define module mock
abd23d0c 9Summary: A Python Mocking and Patching Library for Testing
8bab2895 10Summary(pl.UTF-8): Biblioteka Pythona do testów przy użyciu techniki "mock" i łatania
abd23d0c 11Name: python-%{module}
8d6481b4 12Version: 2.0.0
42d7dba5 13Release: 4
abd23d0c 14License: BSD-like
15Group: Development/Languages/Python
0d282d8d
JB
16#Source0Download: https://pypi.python.org/simple/mock/
17Source0: https://pypi.python.org/packages/source/m/mock/%{module}-%{version}.tar.gz
8d6481b4 18# Source0-md5: 0febfafd14330c9dcaa40de2d82d40ad
abd23d0c 19URL: http://python-mock.sourceforge.net/
2ce3f042 20BuildRequires: rpm-pythonprov
9830114b 21BuildRequires: rpmbuild(macros) >= 1.710
a9c81cc9 22%if %{with python2}
0d282d8d 23BuildRequires: python-modules >= 1:2.6
0d282d8d 24BuildRequires: python-setuptools >= 17.1
32e3a440
JB
25%if %{with tests}
26BuildRequires: python-pbr >= 1.3
0d282d8d 27BuildRequires: python-six >= 1.7
32e3a440
JB
28BuildRequires: python-unittest2 >= 1.1.0
29%endif
a9c81cc9
JK
30%endif
31%if %{with python3}
0d282d8d 32BuildRequires: python3-modules >= 1:3.2
0d282d8d 33BuildRequires: python3-setuptools >= 17.1
32e3a440
JB
34%if %{with doc} || %{with tests}
35BuildRequires: python3-pbr >= 1.3
0d282d8d 36BuildRequires: python3-six >= 1.7
32e3a440 37%endif
0d282d8d 38%{?with_tests:BuildRequires: python3-unittest2 >= 1.1.0}
a9c81cc9 39%endif
32e3a440
JB
40%if %{with doc}
41BuildRequires: sphinx-pdg-3
42%endif
abd23d0c 43BuildArch: noarch
44BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
45
46%description
8bab2895
JB
47mock is a library for testing in Python. It allows you to replace
48parts of your system under test with mock objects and make assertions
49about how they have been used.
abd23d0c 50
8bab2895
JB
51mock provides a core `MagicMock` class removing the need to create a
52host of stubs throughout your test suite. After performing an action,
53you can make assertions about which methods/attributes were used and
54arguments they were called with. You can also specify return values
55and set needed attributes in the normal way.
abd23d0c 56
8bab2895 57The mock module also provides utility functions/objects to assist with
abd23d0c 58testing, particularly monkey patching.
59
8bab2895
JB
60%description -l pl.UTF-8
61mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie
62części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień
63(assert) o tym, jak zostały użyte.
64
65mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba
66tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można
67kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi
68argumentami. Można określić zwracane wartości i w zwykły sposób
69ustawiać potrzebne atrybuty.
70
8bab2895
JB
71Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające
72przy testowaniu, w szczególności łataniu.
73
a9c81cc9
JK
74%package -n python3-%{module}
75Summary: A Python Mocking and Patching Library for Testing
76Summary(pl.UTF-8): Biblioteka Pythona do testów przy użyciu techniki "mock" i łatania
77Group: Development/Languages/Python
78
79%description -n python3-%{module}
80mock is a library for testing in Python. It allows you to replace
81parts of your system under test with mock objects and make assertions
82about how they have been used.
83
84mock provides a core `MagicMock` class removing the need to create a
85host of stubs throughout your test suite. After performing an action,
86you can make assertions about which methods/attributes were used and
87arguments they were called with. You can also specify return values
88and set needed attributes in the normal way.
89
a9c81cc9
JK
90The mock module also provides utility functions/objects to assist with
91testing, particularly monkey patching.
92
93%description -n python3-%{module} -l pl.UTF-8
94mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie
95części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień
96(assert) o tym, jak zostały użyte.
97
98mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba
99tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można
100kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi
101argumentami. Można określić zwracane wartości i w zwykły sposób
102ustawiać potrzebne atrybuty.
103
a9c81cc9
JK
104Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające
105przy testowaniu, w szczególności łataniu.
106
8458ad63 107%package apidocs
0d282d8d
JB
108Summary: API documentation for mock module
109Summary(pl.UTF-8): Dokumentacja API modułu mock
8458ad63
ER
110Group: Documentation
111
112%description apidocs
0d282d8d 113API documentation for mock module.
8458ad63
ER
114
115%description apidocs -l pl.UTF-8
0d282d8d 116Dokumentacja API modułu mock.
a9c81cc9 117
abd23d0c 118%prep
119%setup -q -n %{module}-%{version}
120
0d282d8d
JB
121# avoid rewriting by pbr
122chmod a-w AUTHORS ChangeLog
123
abd23d0c 124%build
a9c81cc9 125%if %{with python2}
0d282d8d 126%py_build %{?with_tests:test}
a9c81cc9
JK
127%endif
128
129%if %{with python3}
0d282d8d
JB
130%py3_build %{?with_tests:test}
131%endif
132
133%if %{with doc}
32e3a440 134PYTHONPATH=. sphinx-build-3 -b html docs html
0d282d8d 135%{__rm} -r html/{_sources,.doctrees,.buildinfo}
a9c81cc9 136%endif
abd23d0c 137
138%install
139rm -rf $RPM_BUILD_ROOT
a9c81cc9
JK
140
141%if %{with python2}
ec928db2 142%py_install
abd23d0c 143
144%py_postclean
a9c81cc9
JK
145%endif
146
147%if %{with python3}
ec928db2 148%py3_install
0d282d8d
JB
149
150# pythonegg dependency generator resolves conditionals for requires() based on
151# python version that runs the generator, not the version egg is targeted;
152# avoid generation of python3egg(funcsigs) dependency for python >= 3.3
153%{__sed} -i -e '/^\[:(python_version<"3.3")]/,/^$/d' $RPM_BUILD_ROOT%{py3_sitescriptdir}/mock-%{version}-py*.egg-info/requires.txt
a9c81cc9 154%endif
abd23d0c 155
156%clean
157rm -rf $RPM_BUILD_ROOT
158
a9c81cc9 159%if %{with python2}
abd23d0c 160%files
161%defattr(644,root,root,755)
0d282d8d
JB
162%doc AUTHORS ChangeLog LICENSE.txt NEWS README.rst
163%{py_sitescriptdir}/mock
8bab2895 164%{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
abd23d0c 165%endif
a9c81cc9
JK
166
167%if %{with python3}
168%files -n python3-%{module}
169%defattr(644,root,root,755)
0d282d8d
JB
170%doc AUTHORS ChangeLog LICENSE.txt NEWS README.rst
171%{py3_sitescriptdir}/mock
172%{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
a9c81cc9 173%endif
8458ad63
ER
174
175%if %{with doc}
176%files apidocs
177%defattr(644,root,root,755)
178%doc html/*
179%endif
This page took 0.118306 seconds and 4 git commands to generate.