summaryrefslogtreecommitdiff
path: root/coverage/backunittest.py
diff options
context:
space:
mode:
authorNed Batchelder <nedbat@gmail.com>2015-08-01 12:53:22 -0400
committerNed Batchelder <nedbat@gmail.com>2015-08-01 12:53:22 -0400
commit162bab174bf05323e75e247411b8c86e49420415 (patch)
tree94f28318f3267dc16a7b8bb1f597d8fb52033bee /coverage/backunittest.py
parent78a0ad5a6b4668dc9f1807d7bfb431d263b7b071 (diff)
parent9559181fa49011bc94e51c967010e2cb49714d15 (diff)
downloadpython-coveragepy-162bab174bf05323e75e247411b8c86e49420415.tar.gz
Merged in traff/coverage.py (pull request #50)
Look for __main__ module if coverage is being run for directory #252
Diffstat (limited to 'coverage/backunittest.py')
-rw-r--r--coverage/backunittest.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/coverage/backunittest.py b/coverage/backunittest.py
index 95b6fcc..09574cc 100644
--- a/coverage/backunittest.py
+++ b/coverage/backunittest.py
@@ -1,3 +1,6 @@
+# Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
+# For details: https://bitbucket.org/ned/coveragepy/src/default/NOTICE.txt
+
"""Implementations of unittest features from the future."""
# Use unittest2 if it's available, otherwise unittest. This gives us
@@ -22,10 +25,13 @@ class TestCase(unittest.TestCase):
"""
# pylint: disable=missing-docstring
- if not unittest_has('assertCountEqual'):
- def assertCountEqual(self, s1, s2):
- """Assert these have the same elements, regardless of order."""
- self.assertEqual(set(s1), set(s2))
+ # Many Pythons have this method defined. But PyPy3 has a bug with it
+ # somehow (https://bitbucket.org/pypy/pypy/issues/2092), so always use our
+ # own implementation that works everywhere, at least for the ways we're
+ # calling it.
+ def assertCountEqual(self, s1, s2):
+ """Assert these have the same elements, regardless of order."""
+ self.assertEqual(sorted(s1), sorted(s2))
if not unittest_has('assertRaisesRegex'):
def assertRaisesRegex(self, *args, **kwargs):