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

Peter Cock p.j.a.cock at googlemail.com
Thu Oct 15 16:37:17 UTC 2015


No objections? Carlos is using unittest2 again for more
test coverage under Python 2.6 here, which I just merged:

https://github.com/biopython/biopython/pull/638

I think requiring unittest2 to run the full test suite under
Python 2.6 seems reasonable. If it is missing, then the
tests get skipped with a warning - so this won't break
automated build scripts.

The payoff is this makes certain tests *much* easier,
e.g. using self.assertRaises as a context manager.

Peter

On Mon, Oct 12, 2015 at 12:27 PM, Peter Cock <p.j.a.cock at googlemail.com> wrote:
> 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