]>
Commit | Line | Data |
---|---|---|
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 | 9 | Summary: A Python Mocking and Patching Library for Testing |
8bab2895 | 10 | Summary(pl.UTF-8): Biblioteka Pythona do testów przy użyciu techniki "mock" i łatania |
abd23d0c | 11 | Name: python-%{module} |
8d6481b4 | 12 | Version: 2.0.0 |
42d7dba5 | 13 | Release: 4 |
abd23d0c | 14 | License: BSD-like |
15 | Group: Development/Languages/Python | |
0d282d8d JB |
16 | #Source0Download: https://pypi.python.org/simple/mock/ |
17 | Source0: https://pypi.python.org/packages/source/m/mock/%{module}-%{version}.tar.gz | |
8d6481b4 | 18 | # Source0-md5: 0febfafd14330c9dcaa40de2d82d40ad |
abd23d0c | 19 | URL: http://python-mock.sourceforge.net/ |
2ce3f042 | 20 | BuildRequires: rpm-pythonprov |
9830114b | 21 | BuildRequires: rpmbuild(macros) >= 1.710 |
a9c81cc9 | 22 | %if %{with python2} |
0d282d8d | 23 | BuildRequires: python-modules >= 1:2.6 |
0d282d8d | 24 | BuildRequires: python-setuptools >= 17.1 |
32e3a440 JB |
25 | %if %{with tests} |
26 | BuildRequires: python-pbr >= 1.3 | |
0d282d8d | 27 | BuildRequires: python-six >= 1.7 |
32e3a440 JB |
28 | BuildRequires: python-unittest2 >= 1.1.0 |
29 | %endif | |
a9c81cc9 JK |
30 | %endif |
31 | %if %{with python3} | |
0d282d8d | 32 | BuildRequires: python3-modules >= 1:3.2 |
0d282d8d | 33 | BuildRequires: python3-setuptools >= 17.1 |
32e3a440 JB |
34 | %if %{with doc} || %{with tests} |
35 | BuildRequires: python3-pbr >= 1.3 | |
0d282d8d | 36 | BuildRequires: 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} |
41 | BuildRequires: sphinx-pdg-3 | |
42 | %endif | |
abd23d0c | 43 | BuildArch: noarch |
44 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
45 | ||
46 | %description | |
8bab2895 JB |
47 | mock is a library for testing in Python. It allows you to replace |
48 | parts of your system under test with mock objects and make assertions | |
49 | about how they have been used. | |
abd23d0c | 50 | |
8bab2895 JB |
51 | mock provides a core `MagicMock` class removing the need to create a |
52 | host of stubs throughout your test suite. After performing an action, | |
53 | you can make assertions about which methods/attributes were used and | |
54 | arguments they were called with. You can also specify return values | |
55 | and set needed attributes in the normal way. | |
abd23d0c | 56 | |
8bab2895 | 57 | The mock module also provides utility functions/objects to assist with |
abd23d0c | 58 | testing, particularly monkey patching. |
59 | ||
8bab2895 JB |
60 | %description -l pl.UTF-8 |
61 | mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie | |
62 | części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień | |
63 | (assert) o tym, jak zostały użyte. | |
64 | ||
65 | mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba | |
66 | tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można | |
67 | kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi | |
68 | argumentami. Można określić zwracane wartości i w zwykły sposób | |
69 | ustawiać potrzebne atrybuty. | |
70 | ||
8bab2895 JB |
71 | Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające |
72 | przy testowaniu, w szczególności łataniu. | |
73 | ||
a9c81cc9 JK |
74 | %package -n python3-%{module} |
75 | Summary: A Python Mocking and Patching Library for Testing | |
76 | Summary(pl.UTF-8): Biblioteka Pythona do testów przy użyciu techniki "mock" i łatania | |
77 | Group: Development/Languages/Python | |
78 | ||
79 | %description -n python3-%{module} | |
80 | mock is a library for testing in Python. It allows you to replace | |
81 | parts of your system under test with mock objects and make assertions | |
82 | about how they have been used. | |
83 | ||
84 | mock provides a core `MagicMock` class removing the need to create a | |
85 | host of stubs throughout your test suite. After performing an action, | |
86 | you can make assertions about which methods/attributes were used and | |
87 | arguments they were called with. You can also specify return values | |
88 | and set needed attributes in the normal way. | |
89 | ||
a9c81cc9 JK |
90 | The mock module also provides utility functions/objects to assist with |
91 | testing, particularly monkey patching. | |
92 | ||
93 | %description -n python3-%{module} -l pl.UTF-8 | |
94 | mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie | |
95 | części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień | |
96 | (assert) o tym, jak zostały użyte. | |
97 | ||
98 | mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba | |
99 | tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można | |
100 | kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi | |
101 | argumentami. Można określić zwracane wartości i w zwykły sposób | |
102 | ustawiać potrzebne atrybuty. | |
103 | ||
a9c81cc9 JK |
104 | Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające |
105 | przy testowaniu, w szczególności łataniu. | |
106 | ||
8458ad63 | 107 | %package apidocs |
0d282d8d JB |
108 | Summary: API documentation for mock module |
109 | Summary(pl.UTF-8): Dokumentacja API modułu mock | |
8458ad63 ER |
110 | Group: Documentation |
111 | ||
112 | %description apidocs | |
0d282d8d | 113 | API documentation for mock module. |
8458ad63 ER |
114 | |
115 | %description apidocs -l pl.UTF-8 | |
0d282d8d | 116 | Dokumentacja API modułu mock. |
a9c81cc9 | 117 | |
abd23d0c | 118 | %prep |
119 | %setup -q -n %{module}-%{version} | |
120 | ||
0d282d8d JB |
121 | # avoid rewriting by pbr |
122 | chmod 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 | 134 | PYTHONPATH=. sphinx-build-3 -b html docs html |
0d282d8d | 135 | %{__rm} -r html/{_sources,.doctrees,.buildinfo} |
a9c81cc9 | 136 | %endif |
abd23d0c | 137 | |
138 | %install | |
139 | rm -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 | |
157 | rm -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 |