summaryrefslogtreecommitdiff
path: root/tests/testutils.py
diff options
context:
space:
mode:
authorHugo <hugovk@users.noreply.github.com>2017-11-28 10:22:02 +0200
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2017-11-28 16:03:23 +0000
commit53c1c5dcc1da6aa36ee9f53c5276739053b85897 (patch)
treea93a20b4ae4857e2533e40b07ebd876d9c23a092 /tests/testutils.py
parentffcc65d4f04190551de5c71c6f106cb92f9235ab (diff)
downloadpsycopg2-53c1c5dcc1da6aa36ee9f53c5276739053b85897.tar.gz
Remove redundant hasattr checks
Diffstat (limited to 'tests/testutils.py')
-rw-r--r--tests/testutils.py33
1 files changed, 2 insertions, 31 deletions
diff --git a/tests/testutils.py b/tests/testutils.py
index ba31e3b..0340189 100644
--- a/tests/testutils.py
+++ b/tests/testutils.py
@@ -32,37 +32,8 @@ from functools import wraps
from testconfig import dsn, repl_dsn
-if hasattr(unittest, 'skipIf'):
- skip = unittest.skip
- skipIf = unittest.skipIf
-
-else:
- import warnings
-
- def skipIf(cond, msg):
- def skipIf_(f):
- @wraps(f)
- def skipIf__(self):
- if cond:
- with warnings.catch_warnings():
- warnings.simplefilter('always', UserWarning)
- warnings.warn(msg)
- return
- else:
- return f(self)
- return skipIf__
- return skipIf_
-
- def skip(msg):
- return skipIf(True, msg)
-
- def skipTest(self, msg):
- with warnings.catch_warnings():
- warnings.simplefilter('always', UserWarning)
- warnings.warn(msg)
- return
-
- unittest.TestCase.skipTest = skipTest
+skip = unittest.skip
+skipIf = unittest.skipIf
# Silence warnings caused by the stubbornness of the Python unittest
# maintainers