Skip to content

Commit

Permalink
Finished release 0.4.
Browse files Browse the repository at this point in the history
  • Loading branch information
htgoebel committed Jun 30, 2019
2 parents 635a1f3 + 60150b3 commit 9f5c09b
Show file tree
Hide file tree
Showing 74 changed files with 768 additions and 113 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
/nosetests.xml
/.cache
/.coverage
/.pytest_cache
/.tox
/.achievements
/.installed.cfg
Expand Down
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
dist: xenial
language: python
# Use new container-based Travis infrastructure.
sudo: false
cache: pip

python:
- 2.7
- 3.2
- 3.3
- 3.4
- 3.5
- 3.6
- 3.7
- "nightly"

allow_failures:
# Just tests how PyInstaller performs with upcoming Python 3.6
# Just tests how PyInstaller performs with upcoming Python 3.8
- python: "nightly"

# Install dependencies.
Expand Down
9 changes: 9 additions & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ Contributors
The number im front of each name denotes the number of commits by the
respective contributor.

Contributors for v0.4
------------------------

25 Hartmut Goebel <[email protected]>
6 Jon Dufresne <[email protected]>
2 Thomas Grainger <[email protected]>
1 Aaron Godfrey <[email protected]>
1 Joshua Howard <[email protected]>


Contributors for v0.3
------------------------
Expand Down
27 changes: 26 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,9 +1,34 @@
Changelog
============

v0.3 (2016-07-26)
0.4 (2019-06-30)
----------------

* Add support for ``assertDictContainsSubset``.

* Put parenthesis around expressions if required.

* Fixed assertRaisesRegex, assertRaisesRegexp and assertWarnsRegex.
The regex was getting replaced with an undefined variable `pattern`.

* Fix assertRaisesRegex and assertRaisesRegexp with `**kwargs` and
`atom` parameters.

* Made assertRaisesRegex, assertRaisesRegexp and assertWarnsRegex use
the `match` kwarg in `pytest.raises` instead of creating a variable
with the context manager and doing an assert on `re.search`.


* Add a short developer guide.

* Remove testing on Python 3.0, 3.1, 3.2, add 3.6 and 3.7.

* Distribute package as a universal wheel.


v0.3 (2016-07-26)
------------------

* Add support for assertRaises / assertWarns context managers.

* Add support for converting lambda arguments in assertRaises into
Expand Down
225 changes: 225 additions & 0 deletions DEVELOPER.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@

Testing
===========

Continuous integration tests are available at
https://travis-ci.org/pytest-dev/unittest2pytest/.

Prior to pushing a pull-request to github, please test locally::

pip install tox pytest
tox # or tox -e py27,py33,py34


Version Scheme
=================

Regarding the version scheme, unittest2pytest conforms to :PEP:`440`.
This basically means that releases will look like `0.3`, `0.3.1`,
`0.4`, and pre-releases will have versions like `0.3.dev1`,
`0.3.1.dev0`.


How to Release
=================


Preparation
-----------------

1. Get yourself an account at PyPI_ and TestPyPI_. Fill both
credentials in your `~/.pypirc` file, as `described in the Python
Wiki <https://wiki.python.org/moin/TestPyPI>`_.

* In difference to that description, list `pypitest` *first*. This
will make `zest.releaser` push the release there first giving you
a chance for last minute fixes.

2. Install `docutils` and `zest.releaser`, a helper for automating
releasing a Python project::

pip install --user docutils zest.releaser


Full Release Process
---------------------

1. Prepare (see above).

2. Implement and close all issues and pull requests in a specific
milestone.

3. Ensure everything relevant is committed and tested. ``git stash``
your local changes which should not go into the release.

4. Be sure that the current code passes tests locally::

tox -e py27,py33,py34

5. Be sure `CI tests
<https://travis-ci.org/pytest-dev/unittest2pytest/>`_ pass.


Now we start with the main release process.

6. Set shell variables to be able to copy-and-paste the remaining
snippets, e.g.::

version=0.3
prev_version=0.2

7. Create the **release branch**::

git checkout -b release/$version

8. **Update versions** in source-code, Changelog, etc.::

prerelease # zest.releaser command

This will

- ask you a few questions - required version, etc.
- remove `.devN` from the version string
- update date and version in `CHANGES.rst`

9. Update **``CHANGES.rst``** and **``AUTHORS``**.

Where to look for possible changes? You can look in pull requests,
issues, commits, mailing list or even the tool's cli options
(new/removed options).

Authors should be updated based on merged pull requests::

git shortlog --numbered --summary --email v${prev_version}..HEAD

a. Check if the files are valid reStructuredText by running::

rst2html CHANGES.rst > /tmp/CHANGES.html
xdg-open /tmp/CHANGES.html # opens file in your web-browser

b. If everything is fine, commit::

git commit -m "Update CHANGES and AUTHORS for release $version" \
CHANGES.rst AUTHORS.txt


10. In the **README**, update the versions in the badge-images and
related links.

a. Verify the result be running::

git diff --color-words='.' README.rst

b. Again, check if the files are valid reStructuredText by running::

rst2html README.rst > /tmp/README.html
xdg-open /tmp/README.html # opens file in your web-browser

c. If everything is fine, commit::

git commit -m 'Update versions in README.' README.rst
README_CHANGE=$(git rev-parse --short HEAD) # remember this commit

11. Adjust whatever else is required for the release *now*.


12. Complete the release:

a. Merge into branch `master`::

git checkout master
git merge --no-ff -X theirs -m "Finished release $version." \
release/$version

b. In case of a merge-conflict, resolve it using::

git gui # In the context-menu select "Use Local Version"
git commit -m "Release $version."


13. Run the release script ``release`` and it will do:

- create a signed tag for the released version
- create and sign source archives
- uploads them to PyPI

::

release # zest.releaser command

Submit to `testpypi` first! You can not change any file after
you've uploaded it to PyPI!

14. Push the changes::

git push --follow-tags origin master

15. Create release on github:

a. Go to the `unittest2pytest release page
<https://github.com/pytest-dev/unittest2pytest/releases>`_

b. Edit the latest `tag` details.

c. Copy there changelog for the current release. This should look
like `this one
<https://github.com/pytest-dev/unittest2pytest/releases/tag/v0.3>`_

d. Upload the `.tar.gz`- and `.zip`-archives and GPG-signatures
that where uploaded to |unittest2pytest@PyPI|_

Note: If you are using stuff like RequestBlocker or NoScript in
your web-browser, mind to allow some additional access.


Now we are going to perform some **post-release** steps:

16. Forward the release-branch to master and check it out::

git checkout master
git branch -f release/$version master
git checkout release/$version

17. Revert the version-related to the README (using the commit we
remembered earlier)::

git revert $README_CHANGE

18. Run the release script ``postrelease``::

postrelease # zest.releaser command

This will

- increment version string for a new release: `3.0 -> 3.1.dev0`
- prepare `CHANGES.rst` for the next release.

You need to manually check the `README` and the version in
`CHANGES`.

19. Merge into branch `develop`::

git checkout develop
git merge --no-ff -m "Finished release $version." release/$version

20. Check the diffs: it should only be version related stuff::

git diff origin/develop

21. Push the changes and delete the local release branch::

git push --follow-tags origin develop master
git branch -d release/$version


.. _PyPI: https://pypi.python.org/
.. _TestPyPI: https://testpypi.python.org/pypi
.. |unittest2pytest@PyPI| replace:: unittest2pytest at PyPI
.. _unittest2pytest@PyPI: https://pypi.python.org/unittest2pytest

..
Local Variables:
mode: rst
ispell-local-dictionary: "american"
coding: utf-8
End:
7 changes: 3 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@ Helps converting unittest test-cases to pytest
-----------------------------------------------------

:Author: Hartmut Goebel <[email protected]>
:Version: Version 0.3
:Copyright: Hartmut Goebel
:Version: 0.4
:Copyright: 2015-2019 by Hartmut Goebel
:Licence: GNU Public Licence v3 or later (GPLv3+)
:Homepage: https://github.com/pytest-dev/unittest2pytest


.. image:: https://img.shields.io/travis/pytest-dev/unittest2pytest/v0.3.svg
.. image:: https://secure.travis-ci.org/pytest-dev/unittest2pytest.png?branch=develop
:target: https://travis-ci.org/pytest-dev/unittest2pytest/
:alt: Travis CI test status


`unittest2pytest` is a tool that helps rewriting Python `unittest`
Expand Down
7 changes: 7 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
[bdist_wheel]
universal = 1

[zest.releaser]
python-file-with-version = unittest2pytest/__init__.py
push-changes = no
tag-format = v{version}
tag-message = unittest2pytest {version}
tag-signing = yes
14 changes: 12 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2015 by Hartmut Goebel <[email protected]>
# Copyright 2015-2019 by Hartmut Goebel <[email protected]>
#
# This file is part of unittest2pytest.
#
Expand Down Expand Up @@ -69,6 +69,16 @@ def read(filename):
"License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Software Development",
"Topic :: Utilities",
])
],
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*",
zip_safe=False
)
3 changes: 3 additions & 0 deletions tests/fixtures/self_assert/assertAlmostEqual_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
class TestAlmostAssertEqual(TestCase):
def test_simple(self):
self.assertAlmostEqual(100, klm)
self.assertAlmostEqual(456, aaa and bbb)
self.assertAlmostEqual(789, ccc or ddd)
self.assertAlmostEqual(123, True if You else False)

def test_simple_msg(self):
self.assertAlmostEqual(klm, 100, msg="This is wrong!")
Expand Down
3 changes: 3 additions & 0 deletions tests/fixtures/self_assert/assertAlmostEqual_out.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
class TestAlmostAssertEqual(TestCase):
def test_simple(self):
assert round(abs(100-klm), 7) == 0
assert round(abs(456-(aaa and bbb)), 7) == 0
assert round(abs(789-(ccc or ddd)), 7) == 0
assert round(abs(123-(True if You else False)), 7) == 0

def test_simple_msg(self):
assert round(abs(klm-100), 7) == 0, "This is wrong!"
Expand Down
Loading

0 comments on commit 9f5c09b

Please sign in to comment.