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