Detailed tests of baserelease.py
================================

.. :doctest:
.. :setup: zest.releaser.tests.functional.setup
.. :teardown: zest.releaser.tests.functional.teardown

Change to an svn dir:

    >>> svnsourcedir
    'TESTTEMP/tha.example-svn'
    >>> import os
    >>> os.chdir(svnsourcedir)

Init the Basereleaser, which is otherwise only used as a base class.

    >>> from zest.releaser import baserelease
    >>> base = baserelease.Basereleaser()

The data dict is initialized.  And a vcs is chosen:

    >>> base.data['workingdir']
    'TESTTEMP/tha.example-svn'
    >>> base.data['name']
    'tha.example'
    >>> base.vcs
    <Subversion at TESTTEMP/tha.example-svn .>

Two methods are unimplemented:

    >>> base.prepare()
    Traceback (most recent call last):
    ...
    NotImplementedError
    >>> base.execute()
    Traceback (most recent call last):
    ...
    NotImplementedError

We can update commit messages based on what we find in ``setup.cfg``::

    >>> lines = [
    ...     "[zest.releaser]",
    ...     "extra-message = Aargh!"]
    >>> dont_care = open('setup.cfg', 'w').write('\n'.join(lines))
    >>> base = baserelease.Basereleaser()
    >>> print(base.update_commit_message('Ni!'))
    Ni!
    <BLANKLINE>
    Aargh!

Check that this works with non-ascii too.

    >>> lines = [
    ...     "[zest.releaser]".encode('utf-8'),
    ...     "extra-message = \u2603".encode('utf-8')]
    >>> dont_care = open('setup.cfg', 'wb').write(b'\n'.join(lines))
    >>> base = baserelease.Basereleaser()
    >>> base.update_commit_message('Ni!')
    'Ni!\n\n\u2603'

And check with multiple lines.

    >>> lines = [
    ...     "[zest.releaser]",
    ...     "extra-message =",
    ...     "    Where is my towel?",
    ...     "    Not again."]
    >>> dont_care = open('setup.cfg', 'w').write('\n'.join(lines))
    >>> base = baserelease.Basereleaser()
    >>> print(base.update_commit_message('Ni!'))
    Ni!
    <BLANKLINE>
    Where is my towel?
    Not again.
