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