]> git.pld-linux.org Git - packages/python-mock.git/blob - python-mock.spec
- disable python3 here
[packages/python-mock.git] / python-mock.spec
1 # NOTE: for version >= 4.0.0 (for python 3.6+) see python3-mock.spec
2 #
3 # Conditional build:
4 %bcond_without  doc     # Sphinx documentation
5 %bcond_without  python2 # CPython 2.x module
6 %bcond_with     python3 # CPython 3.x module (built from python3-mock.spec)
7 %bcond_without  tests   # unit tests
8
9 %define         module  mock
10 Summary:        Rolling backport of unittest.mock for all Pythons
11 Summary(pl.UTF-8):      Podążający backport modułu unittest.mock dla wszystkich wersji Pythona
12 Name:           python-%{module}
13 # keep 3.x here for python2 support
14 Version:        3.0.5
15 Release:        1
16 License:        BSD
17 Group:          Development/Languages/Python
18 ##Source0Download: https://pypi.org/simple/mock/
19 #Source0:       https://files.pythonhosted.org/packages/source/m/mock/%{module}-%{version}.tar.gz
20 # pypi dist misses docs and tests, use github archive
21 #Source0Download: https://github.com/testing-cabal/mock/releases
22 Source0:        https://github.com/testing-cabal/mock/archive/%{version}/%{module}-%{version}.tar.gz
23 # Source0-md5:  4026d6ad2a518ae05b993f5ea28ede75
24 URL:            http://python-mock.sourceforge.net/
25 %if %{with python2}
26 BuildRequires:  python-modules >= 1:2.7
27 BuildRequires:  python-setuptools >= 17.1
28 %if %{with tests}
29 BuildRequires:  python-funcsigs >= 1
30 BuildRequires:  python-pytest
31 BuildRequires:  python-six >= 1.9
32 %endif
33 %endif
34 %if %{with python3}
35 BuildRequires:  python3-modules >= 1:3.4
36 BuildRequires:  python3-setuptools >= 17.1
37 %if %{with tests}
38 BuildRequires:  python3-pytest
39 BuildRequires:  python3-six >= 1.9
40 %endif
41 %endif
42 BuildRequires:  rpm-pythonprov
43 BuildRequires:  rpmbuild(macros) >= 1.714
44 %if %{with doc}
45 BuildRequires:  python3-six >= 1.9
46 BuildRequires:  sphinx-pdg-3
47 %endif
48 BuildArch:      noarch
49 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
50
51 %description
52 mock is a library for testing in Python. It allows you to replace
53 parts of your system under test with mock objects and make assertions
54 about how they have been used.
55
56 mock provides a core `MagicMock` class removing the need to create a
57 host of stubs throughout your test suite. After performing an action,
58 you can make assertions about which methods/attributes were used and
59 arguments they were called with. You can also specify return values
60 and set needed attributes in the normal way.
61
62 The mock module also provides utility functions/objects to assist with
63 testing, particularly monkey patching.
64
65 %description -l pl.UTF-8
66 mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie
67 części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień
68 (assert) o tym, jak zostały użyte.
69
70 mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba
71 tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można
72 kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi
73 argumentami. Można określić zwracane wartości i w zwykły sposób
74 ustawiać potrzebne atrybuty.
75
76 Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające
77 przy testowaniu, w szczególności łataniu.
78
79 %package -n python3-%{module}
80 Summary:        Rolling backport of unittest.mock for all Pythons
81 Summary(pl.UTF-8):      Podążający backport modułu unittest.mock dla wszystkich wersji Pythona
82 Group:          Development/Languages/Python
83
84 %description -n python3-%{module}
85 mock is a library for testing in Python. It allows you to replace
86 parts of your system under test with mock objects and make assertions
87 about how they have been used.
88
89 mock provides a core `MagicMock` class removing the need to create a
90 host of stubs throughout your test suite. After performing an action,
91 you can make assertions about which methods/attributes were used and
92 arguments they were called with. You can also specify return values
93 and set needed attributes in the normal way.
94
95 The mock module also provides utility functions/objects to assist with
96 testing, particularly monkey patching.
97
98 %description -n python3-%{module} -l pl.UTF-8
99 mock to biblioteka do testowania w Pythonie. Pozwala na zastępowanie
100 części testowanego systemu obiektami "mock" oraz sprawdzania zapewnień
101 (assert) o tym, jak zostały użyte.
102
103 mock udostępnia klasę główną "MagicMock", dzięki której nie trzeba
104 tworzyć systemu zaślepek do testów. W czasie wykonywania akcji można
105 kontrolować, czy odpowiednie metody/atrybuty zostały użyte i z jakimi
106 argumentami. Można określić zwracane wartości i w zwykły sposób
107 ustawiać potrzebne atrybuty.
108
109 Moduł mock udostępnia także funkcje/obiekty narzędziowe pomagające
110 przy testowaniu, w szczególności łataniu.
111
112 %package apidocs
113 Summary:        API documentation for mock module
114 Summary(pl.UTF-8):      Dokumentacja API modułu mock
115 Group:          Documentation
116
117 %description apidocs
118 API documentation for mock module.
119
120 %description apidocs -l pl.UTF-8
121 Dokumentacja API modułu mock.
122
123 %prep
124 %setup -q -n %{module}-%{version}
125
126 %build
127 %if %{with python2}
128 %py_build
129
130 %if %{with tests}
131 # disable plugins (e.g. pytest-mock) to avoid changing assert output
132 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
133 %{__python} -m pytest mock/tests
134 %endif
135 %endif
136
137 %if %{with python3}
138 %py3_build
139
140 %if %{with tests}
141 # disable plugins (e.g. pytest-mock) to avoid changing assert output
142 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \
143 %{__python3} -m pytest mock/tests
144 %endif
145 %endif
146
147 %if %{with doc}
148 PYTHONPATH=. sphinx-build-3 -b html docs html
149 %{__rm} -r html/{_sources,.doctrees,.buildinfo}
150 %endif
151
152 %install
153 rm -rf $RPM_BUILD_ROOT
154
155 %if %{with python2}
156 %py_install
157
158 %py_postclean
159 %endif
160
161 %if %{with python3}
162 %py3_install
163 %endif
164
165 %clean
166 rm -rf $RPM_BUILD_ROOT
167
168 %if %{with python2}
169 %files
170 %defattr(644,root,root,755)
171 %doc CHANGELOG.rst LICENSE.txt README.rst
172 %{py_sitescriptdir}/mock
173 %{py_sitescriptdir}/%{module}-%{version}-py*.egg-info
174 %endif
175
176 %if %{with python3}
177 %files -n python3-%{module}
178 %defattr(644,root,root,755)
179 %doc CHANGELOG.rst LICENSE.txt README.rst
180 %{py3_sitescriptdir}/mock
181 %{py3_sitescriptdir}/%{module}-%{version}-py*.egg-info
182 %endif
183
184 %if %{with doc}
185 %files apidocs
186 %defattr(644,root,root,755)
187 %doc html/{_static,*.html,*.js}
188 %endif
This page took 0.033105 seconds and 3 git commands to generate.