[Biopython-dev] Requiring unittest2 to run tests on Python 2?

Peter Cock p.j.a.cock at googlemail.com
Mon Oct 12 11:27:53 UTC 2015


Hi all,

Those of you who have contributed functional tests using the
unittest framework will have noticed that many of the nicer
features are missing on Python 2.6, and some even in
Python 2.7

In general we've managed with simple but awkward workarounds,
e.g. as long as we use Python 2.6 we have this:

 self.assertTrue(isinstance(some_object, some_class))

rather than:

 self.assertIsInstance(some_object, some_class))

In the work and discussion for pull request 634, for assertRaises
Carlos used the unittest backport library under Python 2.6:

https://github.com/biopython/biopython/pull/634
https://pypi.python.org/pypi/unittest2

I felt that given we're now deprecating Python 2.6, having an
extra dependency for some of our tests under Python 2.6 was
not unreasonable.

How would people feel about wider use of this backport
for things missing in the Python 2.6 and 2.7 unittest?

It looks too big to bundle under Bio._py3k, so we'd have
to declare unittest2 as a Python 2 only dependency.

Peter


More information about the Biopython-dev mailing list