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