File python-fudge.spec of Package python-fudge

#
# spec file for package python-fudge
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:           python-fudge
Version:        1.0.3
Release:        0
License:        MIT
Summary:        Replace real objects with fakes (mocks, stubs, etc) while testing
Url:            http://farmdev.com/projects/fudge/
Group:          Development/Languages/Python
Source:         http://pypi.python.org/packages/source/f/fudge/fudge-%{version}.tar.gz
BuildRequires:  python-Sphinx
BuildRequires:  python-devel
BuildRequires:  python-nose
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch:      noarch
%endif

%description
Complete documentation is available at http://farmdev.com/projects/fudge/

Fudge is a Python module for using fake objects (mocks and stubs) to test real ones.

In readable Python code, you declare what methods are available on your fake and
how they should be called. Then you inject that into your application and start
testing. This declarative approach means you don't have to record and playback
actions and you don't have to inspect your fakes after running code. If the fake
object was used incorrectly then you'll see an informative exception message
with a traceback that points to the culprit.

Here is a quick preview of how you can test code that sends
email without actually sending email::

    @fudge.patch('smtplib.SMTP')
    def test_mailer(FakeSMTP):
        # Declare how the SMTP class should be used:
        (FakeSMTP.expects_call()
                 .expects('connect')
                 .expects('sendmail').with_arg_count(3))
        # Run production code:
        send_mail()
        # ...expectations are verified automatically at the end of the test

%prep
%setup -q -n fudge-%{version}
find . -type f -name "._*" | xargs rm # Remove junk

%build
python setup.py build
cd docs && make html && rm -r _build/html/.buildinfo # Build HTML documentation

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}

%check
nosetests

%files
%defattr(-,root,root,-)
%doc LICENSE.txt README.txt docs/_build/html
%{python_sitelib}/*

%changelog
openSUSE Build Service is sponsored by