summaryrefslogtreecommitdiff
path: root/python-automock.spec
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-18 04:28:27 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-18 04:28:27 +0000
commitf1dc13cb1de7aa8e0982d001a537bc69f86e9742 (patch)
treed87b5abe5ecdf3e7832910036b94a9a38869ce4f /python-automock.spec
parent1c4ff6782262e5a31165eb3a4433907f52ba9bbd (diff)
automatic import of python-automock
Diffstat (limited to 'python-automock.spec')
-rw-r--r--python-automock.spec144
1 files changed, 144 insertions, 0 deletions
diff --git a/python-automock.spec b/python-automock.spec
new file mode 100644
index 0000000..6bc4a34
--- /dev/null
+++ b/python-automock.spec
@@ -0,0 +1,144 @@
+%global _empty_manifest_terminate_build 0
+Name: python-automock
+Version: 1.2.1
+Release: 1
+Summary: Utility to allow some functions to be 'mocked by default' when running tests.
+License: Apache 2.0
+URL: https://github.com/depop/python-automock
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/df/5f/0509d70838722ebd315c9a6d5381b34c3fd3d477458c7b599e851f719f03/automock-1.2.1.tar.gz
+BuildArch: noarch
+
+
+%description
+|PyPI Version| |Build Status|
+There are some things that need to be mocked in unit tests.
+For example: API clients for other backend services - we don't want to run an
+instance of the other service just for our unit tests. The other service will
+have its own tests and we only want to test that our code confiorms to the API
+contract of the other service. Similarly for 3rd party services - we don't want
+our unit tests to connect out over the internet to talk to the 3rd party service
+(even if they offer a 'sandbox' test environment) for the same reasons as above,
+and because this is a recipe for flaky tests.
+(There is certainly a role for integration tests which do make live calls to
+other services, but the bulk of tests won't be this kind and need mocking).
+Python has the excellent `mock <http://www.voidspace.org.uk/python/mock/>`_ library to help with this.
+However, say you have six API clients for backend services which are used
+extensively in many places in code for your mobile app backend. You're going to
+end up with a big 'stack' of patch decorators on many tests, e.g.:
+ @mock.patch('services.users.client.get_user', return_value=MockUser(id=1))
+ @mock.patch('services.products.client.get_product', return_value=MockProduct(id=1))
+ @mock.patch('services.paypal.client.make_payment', return_value=PaypalResult('success'))
+ def test_some_web_view(self, *mocks)
+Say you have thousands of unit tests, these decorators need applying to many of
+them. Every time you write a new test you'll need to remember to patch things.
+Enter ``automock``.
+Basically we want some functions to be 'mocked by default' when running tests.
+But we also need to be able to easily replace the default mocks in some cases,
+where the test needs a specific return value. ``automock`` makes this easy-ish.
+
+%package -n python3-automock
+Summary: Utility to allow some functions to be 'mocked by default' when running tests.
+Provides: python-automock
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-automock
+|PyPI Version| |Build Status|
+There are some things that need to be mocked in unit tests.
+For example: API clients for other backend services - we don't want to run an
+instance of the other service just for our unit tests. The other service will
+have its own tests and we only want to test that our code confiorms to the API
+contract of the other service. Similarly for 3rd party services - we don't want
+our unit tests to connect out over the internet to talk to the 3rd party service
+(even if they offer a 'sandbox' test environment) for the same reasons as above,
+and because this is a recipe for flaky tests.
+(There is certainly a role for integration tests which do make live calls to
+other services, but the bulk of tests won't be this kind and need mocking).
+Python has the excellent `mock <http://www.voidspace.org.uk/python/mock/>`_ library to help with this.
+However, say you have six API clients for backend services which are used
+extensively in many places in code for your mobile app backend. You're going to
+end up with a big 'stack' of patch decorators on many tests, e.g.:
+ @mock.patch('services.users.client.get_user', return_value=MockUser(id=1))
+ @mock.patch('services.products.client.get_product', return_value=MockProduct(id=1))
+ @mock.patch('services.paypal.client.make_payment', return_value=PaypalResult('success'))
+ def test_some_web_view(self, *mocks)
+Say you have thousands of unit tests, these decorators need applying to many of
+them. Every time you write a new test you'll need to remember to patch things.
+Enter ``automock``.
+Basically we want some functions to be 'mocked by default' when running tests.
+But we also need to be able to easily replace the default mocks in some cases,
+where the test needs a specific return value. ``automock`` makes this easy-ish.
+
+%package help
+Summary: Development documents and examples for automock
+Provides: python3-automock-doc
+%description help
+|PyPI Version| |Build Status|
+There are some things that need to be mocked in unit tests.
+For example: API clients for other backend services - we don't want to run an
+instance of the other service just for our unit tests. The other service will
+have its own tests and we only want to test that our code confiorms to the API
+contract of the other service. Similarly for 3rd party services - we don't want
+our unit tests to connect out over the internet to talk to the 3rd party service
+(even if they offer a 'sandbox' test environment) for the same reasons as above,
+and because this is a recipe for flaky tests.
+(There is certainly a role for integration tests which do make live calls to
+other services, but the bulk of tests won't be this kind and need mocking).
+Python has the excellent `mock <http://www.voidspace.org.uk/python/mock/>`_ library to help with this.
+However, say you have six API clients for backend services which are used
+extensively in many places in code for your mobile app backend. You're going to
+end up with a big 'stack' of patch decorators on many tests, e.g.:
+ @mock.patch('services.users.client.get_user', return_value=MockUser(id=1))
+ @mock.patch('services.products.client.get_product', return_value=MockProduct(id=1))
+ @mock.patch('services.paypal.client.make_payment', return_value=PaypalResult('success'))
+ def test_some_web_view(self, *mocks)
+Say you have thousands of unit tests, these decorators need applying to many of
+them. Every time you write a new test you'll need to remember to patch things.
+Enter ``automock``.
+Basically we want some functions to be 'mocked by default' when running tests.
+But we also need to be able to easily replace the default mocks in some cases,
+where the test needs a specific return value. ``automock`` makes this easy-ish.
+
+%prep
+%autosetup -n automock-1.2.1
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-automock -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 1.2.1-1
+- Package Spec generated