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