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