Cleanup tests:

- always use unittest2
 - remove unneeded boilerplate
 - disable pypy3 in travis, as its currently broken
This commit is contained in:
Robert Collins
2016-04-04 15:38:15 +12:00
parent e70929ceb2
commit 3306968f41
6 changed files with 5 additions and 45 deletions

1
.gitignore vendored
View File

@@ -16,3 +16,4 @@ htmlcov/
tmp/
coverage.xml
junit.xml
.eggs/

View File

@@ -7,7 +7,7 @@ python:
- 3.5
- nightly
- pypy
- pypy3
# - pypy3
install:
- pip install -U pip setuptools wheel
- pip install -r requirements/development.txt .

View File

@@ -26,7 +26,7 @@ The ``funcsigs`` backport has been tested against:
* CPython 3.4
* CPython 3.5
* CPython nightlies
* PyPy and PyPy3
* PyPy and PyPy3(currently failing CI)
Continuous integration testing is provided by `Travis CI`_.

View File

@@ -1,12 +1,6 @@
try:
# python 2.x
import unittest2 as unittest
except ImportError:
# python 3.x
import unittest
import funcsigs
import unittest2 as unittest
class TestFormatAnnotation(unittest.TestCase):
def test_string (self):
@@ -21,7 +15,3 @@ class TestFormatAnnotation(unittest.TestCase):
class dummy (object): pass
self.assertEqual(funcsigs.formatannotation(dummy),
"tests.test_formatannotation.dummy")
if __name__ == "__main__":
unittest.begin()

View File

@@ -85,7 +85,3 @@ class TestFunctionSignatures(unittest.TestCase):
('self', Ellipsis, Ellipsis, self_kind),
('a', Ellipsis, Ellipsis, "positional_or_keyword"),
), Ellipsis))
if __name__ == "__main__":
unittest.begin()

View File

@@ -4,10 +4,7 @@ import collections
import functools
import sys
try:
import unittest2 as unittest
except ImportError:
import unittest
import unittest2 as unittest
import funcsigs as inspect
@@ -25,11 +22,6 @@ class TestSignatureObject(unittest.TestCase):
(Ellipsis if sig.return_annotation is sig.empty
else sig.return_annotation))
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
if not hasattr(self, 'assertRaisesRegex'):
self.assertRaisesRegex = self.assertRaisesRegexp
if sys.version_info[0] > 2:
exec("""
def test_signature_object(self):
@@ -657,11 +649,6 @@ def test_signature_replace_anno(self):
class TestParameterObject(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
if not hasattr(self, 'assertRaisesRegex'):
self.assertRaisesRegex = self.assertRaisesRegexp
def test_signature_parameter_kinds(self):
P = inspect.Parameter
self.assertTrue(P.POSITIONAL_ONLY < P.POSITIONAL_OR_KEYWORD < \
@@ -781,11 +768,6 @@ class TestSignatureBind(unittest.TestCase):
ba = sig.bind(*args, **kwargs)
return func(*ba.args, **ba.kwargs)
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
if not hasattr(self, 'assertRaisesRegex'):
self.assertRaisesRegex = self.assertRaisesRegexp
def test_signature_bind_empty(self):
def test():
return 42
@@ -995,11 +977,6 @@ def test_signature_bind_positional_only(self):
class TestBoundArguments(unittest.TestCase):
def __init__(self, *args, **kwargs):
unittest.TestCase.__init__(self, *args, **kwargs)
if not hasattr(self, 'assertRaisesRegex'):
self.assertRaisesRegex = self.assertRaisesRegexp
def test_signature_bound_arguments_unhashable(self):
def foo(a): pass
ba = inspect.signature(foo).bind(1)
@@ -1023,7 +1000,3 @@ class TestBoundArguments(unittest.TestCase):
def bar(b): pass
ba4 = inspect.signature(bar).bind(1)
self.assertNotEqual(ba, ba4)
if __name__ == "__main__":
unittest.begin()