]>
Commit | Line | Data |
---|---|---|
8458ad63 | 1 | # |
a9c81cc9 | 2 | # Conditional build: |
8458ad63 | 3 | %bcond_without doc # don't build doc |
a9c81cc9 JK |
4 | %bcond_without python2 # CPython 2.x module |
5 | %bcond_without python3 # CPython 3.x module | |
6 | ||
deb91033 | 7 | %define module mock |
abd23d0c | 8 | Summary: A Python Mocking and Patching Library for Testing |
8bab2895 | 9 | Summary(pl.UTF-8): Biblioteka Pythona do testów przy użyciu techniki "mock" i łatania |
abd23d0c | 10 | Name: python-%{module} |
deb91033 | 11 | Version: 1.0.1 |
8458ad63 | 12 | Release: 4 |
abd23d0c | 13 | License: BSD-like |
14 | Group: Development/Languages/Python | |
8bab2895 | 15 | Source0: http://pypi.python.org/packages/source/m/mock/%{module}-%{version}.tar.gz |
deb91033 | 16 | # Source0-md5: c3971991738caa55ec7c356bbc154ee2 |
abd23d0c | 17 | URL: http://python-mock.sourceforge.net/ |
2ce3f042 ER |
18 | BuildRequires: rpm-pythonprov |
19 | BuildRequires: rpmbuild(macros) >= 1.228 | |
a9c81cc9 | 20 | %if %{with python2} |
2ce3f042 ER |
21 | BuildRequires: python-modules |
22 | BuildRequires: python-setuptools | |
a9c81cc9 JK |
23 | %endif |
24 | %if %{with python3} | |
2ce3f042 ER |
25 | BuildRequires: python3-modules |
26 | BuildRequires: python3-setuptools | |
a9c81cc9 | 27 | %endif |
abd23d0c | 28 | BuildArch: noarch |
29 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
30 | ||
31 | %description | |
8bab2895 JB |
32 | mock is a library for testing in Python. It allows you to replace |
33 | parts of your system under test with mock objects and make assertions | |
34 | about how they have been used. | |
abd23d0c | 35 | |
8bab2895 JB |
36 | mock provides a core `MagicMock` class removing the need to create a |
37 | host of stubs throughout your test suite. After performing an action, | |
38 | you can make assertions about which methods/attributes were used and | |
39 | arguments they were called with. You can also specify return values | |
40 | and set needed attributes in the normal way. | |
abd23d0c | 41 | |
8bab2895 JB |
42 | mock is tested on Python versions 2.4-2.7 and Python 3. mock is also |
43 | tested with the latest versions of Jython and pypy. | |
44 | ||
45 | The mock module also provides utility functions/objects to assist with | |
abd23d0c | 46 | testing, particularly monkey patching. |
47 | ||
8bab2895 JB |
48 | %description -l pl.UTF-8 |
49 | mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie | |
50 | części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień | |
51 | (assert) o tym, jak zostały użyte. | |
52 | ||
53 | mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba | |
54 | tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można | |
55 | kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi | |
56 | argumentami. Można określić zwracane wartości i w zwykły sposób | |
57 | ustawiać potrzebne atrybuty. | |
58 | ||
59 | mock jest testowany z Pythonem w wersjach 2.4-2.7 oraz 3, a także z | |
60 | najnowszymi wersjami Jythona i pypy. | |
61 | ||
62 | Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające | |
63 | przy testowaniu, w szczególności łataniu. | |
64 | ||
a9c81cc9 JK |
65 | %package -n python3-%{module} |
66 | Summary: A Python Mocking and Patching Library for Testing | |
67 | Summary(pl.UTF-8): Biblioteka Pythona do testów przy użyciu techniki "mock" i łatania | |
68 | Group: Development/Languages/Python | |
69 | ||
70 | %description -n python3-%{module} | |
71 | mock is a library for testing in Python. It allows you to replace | |
72 | parts of your system under test with mock objects and make assertions | |
73 | about how they have been used. | |
74 | ||
75 | mock provides a core `MagicMock` class removing the need to create a | |
76 | host of stubs throughout your test suite. After performing an action, | |
77 | you can make assertions about which methods/attributes were used and | |
78 | arguments they were called with. You can also specify return values | |
79 | and set needed attributes in the normal way. | |
80 | ||
81 | mock is tested on Python versions 2.4-2.7 and Python 3. mock is also | |
82 | tested with the latest versions of Jython and pypy. | |
83 | ||
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 | ||
98 | mock jest testowany z Pythonem w wersjach 2.4-2.7 oraz 3, a także z | |
99 | najnowszymi wersjami Jythona i pypy. | |
100 | ||
101 | Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające | |
102 | przy testowaniu, w szczególności łataniu. | |
103 | ||
8458ad63 ER |
104 | %package apidocs |
105 | Summary: %{module} API documentation | |
106 | Summary(pl.UTF-8): Dokumentacja API %{module} | |
107 | Group: Documentation | |
108 | ||
109 | %description apidocs | |
110 | API documentation for %{module}. | |
111 | ||
112 | %description apidocs -l pl.UTF-8 | |
113 | Dokumentacja API %{module}. | |
a9c81cc9 | 114 | |
abd23d0c | 115 | %prep |
116 | %setup -q -n %{module}-%{version} | |
117 | ||
118 | %build | |
a9c81cc9 JK |
119 | %if %{with python2} |
120 | %{__python} setup.py build --build-base build-2 | |
121 | %endif | |
122 | ||
123 | %if %{with python3} | |
124 | %{__python3} setup.py build --build-base build-3 | |
125 | %endif | |
abd23d0c | 126 | |
127 | %install | |
128 | rm -rf $RPM_BUILD_ROOT | |
a9c81cc9 JK |
129 | |
130 | %if %{with python2} | |
131 | %{__python} setup.py \ | |
132 | build --build-base build-2 \ | |
133 | install --skip-build \ | |
abd23d0c | 134 | --optimize=2 \ |
135 | --root=$RPM_BUILD_ROOT | |
136 | ||
137 | %py_postclean | |
a9c81cc9 JK |
138 | %endif |
139 | ||
140 | %if %{with python3} | |
141 | %{__python3} setup.py \ | |
142 | build --build-base build-3 \ | |
143 | install --skip-build \ | |
144 | --optimize=2 \ | |
145 | --root=$RPM_BUILD_ROOT | |
146 | %endif | |
abd23d0c | 147 | |
148 | %clean | |
149 | rm -rf $RPM_BUILD_ROOT | |
150 | ||
a9c81cc9 | 151 | %if %{with python2} |
abd23d0c | 152 | %files |
153 | %defattr(644,root,root,755) | |
8458ad63 | 154 | %doc LICENSE.txt README.txt |
8bab2895 | 155 | %{py_sitescriptdir}/mock.py[co] |
8bab2895 | 156 | %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info |
abd23d0c | 157 | %endif |
a9c81cc9 JK |
158 | |
159 | %if %{with python3} | |
160 | %files -n python3-%{module} | |
161 | %defattr(644,root,root,755) | |
8458ad63 | 162 | %doc LICENSE.txt README.txt |
a9c81cc9 JK |
163 | %{py3_sitescriptdir}/mock.py |
164 | %{py3_sitescriptdir}/__pycache__/mock.* | |
165 | %{py3_sitescriptdir}/%{module}-*.egg-info | |
166 | %endif | |
8458ad63 ER |
167 | |
168 | %if %{with doc} | |
169 | %files apidocs | |
170 | %defattr(644,root,root,755) | |
171 | %doc html/* | |
172 | %endif |