Cleanup tests:
- always use unittest2 - remove unneeded boilerplate - disable pypy3 in travis, as its currently broken
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,3 +16,4 @@ htmlcov/
|
||||
tmp/
|
||||
coverage.xml
|
||||
junit.xml
|
||||
.eggs/
|
||||
|
||||
@@ -7,7 +7,7 @@ python:
|
||||
- 3.5
|
||||
- nightly
|
||||
- pypy
|
||||
- pypy3
|
||||
# - pypy3
|
||||
install:
|
||||
- pip install -U pip setuptools wheel
|
||||
- pip install -r requirements/development.txt .
|
||||
|
||||
@@ -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`_.
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user