Skip to content

Commit 635a1f3

Browse files
committed
Finished release 0.3.
2 parents cddeb43 + c2b9173 commit 635a1f3

34 files changed

+457
-27
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
*.egg-link
4343

4444
/nosetests.xml
45+
/.cache
4546
/.coverage
4647
/.tox
4748
/.achievements

AUTHORS.txt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Contributors
2+
==============
3+
4+
The number im front of each name denotes the number of commits by the
5+
respective contributor.
6+
7+
8+
Contributors for v0.3
9+
------------------------
10+
11+
6 Guilherme Quentel Melo <[email protected]>
12+
3 Adam Chainz <[email protected]>
13+
3 Ronny Pfannschmidt <[email protected]>
14+
1 Hartmut Goebel <[email protected]>
15+
16+
17+
Contributors for v0.2
18+
------------------------
19+
20+
17 Hartmut Goebel <[email protected]>
21+
22+
23+
Contributors for v0.1
24+
------------------------
25+
26+
36 Hartmut Goebel <[email protected]>
27+
28+
..
29+
Local Variables:
30+
ispell-local-dictionary: "american"
31+
coding: utf-8
32+
End:

CHANGES.rst

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
Changelog
22
============
33

4+
v0.3 (2016-07-26)
5+
----------------
6+
7+
* Add support for assertRaises / assertWarns context managers.
8+
9+
* Add support for converting lambda arguments in assertRaises into
10+
context managers.
11+
12+
* Fix some incorrect transformations.
13+
14+
* Internal cleanup and fixes.
15+
16+
417
v0.2 (2015-10-20)
518
---------------------
619

7-
* Add support assertRegex/assertRegexpMatches, assertNotRegex
8-
assertRaisesRegex/assertRaisesRegexp assertWarnsRegex.
20+
* Add support for assertRegex/assertRegexpMatches, assertNotRegex,
21+
assertRaisesRegex/assertRaisesRegexp, assertWarnsRegex.
922

1023
* `unittest2pytest` is now a `pytest` subproject.
1124

MANIFEST.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include CHANGES.rst
2+
include COPYING-GPLv3.txt
3+
include README.rst
4+
5+
recursive-include tests *
6+
recursive-exclude * __pycache__
7+
recursive-exclude * *.py[co]

README.rst

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,15 @@ Helps converting unittest test-cases to pytest
77
-----------------------------------------------------
88

99
:Author: Hartmut Goebel <[email protected]>
10-
:Version: Version 0.2
10+
:Version: Version 0.3
1111
:Copyright: Hartmut Goebel
1212
:Licence: GNU Public Licence v3 or later (GPLv3+)
1313
:Homepage: https://github.com/pytest-dev/unittest2pytest
1414

1515

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

1920

2021
`unittest2pytest` is a tool that helps rewriting Python `unittest`
@@ -75,8 +76,15 @@ A list of the available fixers can be found with the following::
7576
self_assert
7677

7778

79+
Note: if your tests use the context managers ``with self.assertRaises`` or
80+
``with self.assertWarns``, they will be transformed to ``pytest.raises`` or
81+
``pytest.warns`` appropriately, but because the semantics are different, any
82+
use of the output value from the context managers (e.g. the ``x`` in
83+
``with pytest.raises(ValueError) as x:``) will be wrong and will require
84+
manual adjustment after the fact.
85+
7886
.. _`lib2to3 documentation`: http://docs.python.org/library/2to3.html
79-
.. _pytest: http://www.python.org/dev/peps/pep-0008/
87+
.. _pytest: https://pytest.org/latest/
8088

8189

8290
..

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[zest.releaser]
2+
python-file-with-version = unittest2pytest/__init__.py

setup.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,20 @@
2121

2222
from setuptools import setup
2323
import codecs
24+
import re
2425
import sys
25-
import unittest2pytest
26+
27+
28+
def get_version(filename):
29+
"""
30+
Return package version as listed in `__version__` in `filename`.
31+
"""
32+
init_py = open(filename).read()
33+
return re.search("__version__ = ['\"]([^'\"]+)['\"]", init_py).group(1)
34+
35+
36+
version = get_version('unittest2pytest/__init__.py')
37+
2638

2739
def read(filename):
2840
try:
@@ -38,7 +50,7 @@ def read(filename):
3850
setup(
3951
name="unittest2pytest",
4052
license='GPLv3+',
41-
version=unittest2pytest.__version__,
53+
version=version,
4254
description="Convert unittest test-cases to pytest",
4355
long_description=long_description,
4456
author="Hartmut Goebel",

tests/fixtures/self_assert/assertDictEqual_in.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,15 @@ def test_simple_msg(self):
99

1010
def test_simple_msg2(self):
1111
self.assertDictEqual(klm, 100, "This is wrong!")
12+
13+
def test_line_wrapping(self):
14+
self.assertDictEqual(
15+
{
16+
'a': 1,
17+
'b': 2,
18+
},
19+
{'b': 2},
20+
"This is wrong!",
21+
)
22+
23+
self.assertDictEqual(100, klm)

tests/fixtures/self_assert/assertDictEqual_out.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,13 @@ def test_simple_msg(self):
99

1010
def test_simple_msg2(self):
1111
assert klm == 100, "This is wrong!"
12+
13+
def test_line_wrapping(self):
14+
assert {
15+
'a': 1,
16+
'b': 2,
17+
} == \
18+
{'b': 2}, \
19+
"This is wrong!"
20+
21+
assert 100 == klm

tests/fixtures/self_assert/assertEqual_in.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,22 @@ def test_everybody(self):
1414
def test_message(self):
1515
self.assertEqual(123+z, xxx+y, msg='This is wrong!')
1616
self.assertEqual(123, xxx+y, 'This is wrong!')
17+
18+
def test_line_wrapping(self):
19+
self.assertEqual(True, False, 'This will fail %s' %
20+
'always')
21+
22+
self.assertEqual(
23+
24+
'abc'
25+
.replace(
26+
'abc'
27+
, 'def'),
28+
'def',
29+
msg='Wrap %s' %
30+
'everything')
31+
32+
def test_expression_as_argument(self):
33+
self.assertEqual(abc not in self.data, True)
34+
self.assertEqual(abc in self.data, not contains)
35+
self.assertEqual(contains, not contains)

0 commit comments

Comments
 (0)