[Biopython-dev] [Bug 2820] Convert test_PDB.py to unittest
bugzilla-daemon at portal.open-bio.org
bugzilla-daemon at portal.open-bio.org
Sun May 10 09:50:50 EDT 2009
http://bugzilla.open-bio.org/show_bug.cgi?id=2820
------- Comment #13 from eric.talevich at gmail.com 2009-05-10 09:50 EST -------
(In reply to comment #12)
> Would it be easy for you to test your code on Python 2.4? I can probably do
> that but not right now...
Yes, I can do that, but only on Linux. I don't think there's anything
platform-specific here, though.
> I would prefer to avoid the extra file by writing this test as part of
> test_PDB_unit.py - but the "with" statement isn't valid syntax on Python 2.4,
> although it can be used on Python 2.5 via:
> from __future__ import with_statement
>
> Could you re-write this to avoid the with statement?
I think the with statement is isomorphic to a try-except-finally arrangement,
calling the context manager's __enter__ method in the try block and __exit__ in
the finally block. I'll look at the source code of the warnings module and
maybe just copy a substantial chunk of it into this unit test (assuming it's
pure Python). That might make it possible to support Py2.4, too.
> Ideally the unit tests should work in any order - and this is generally a
> reasonable assumption, as they should be independent. Having some carefully
> named unit tests will only hide the ordering problem (which is due to the
> global state information in the warnings module). At the very least, we should
> probably have comments in the code about this (to avoid issues in the future)
> and maybe use an eye-catching name like AAAAA which should always come first.
>
Agreed. I'll tinker with it some more to see what can be improved here.
--
Configure bugmail: http://bugzilla.open-bio.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Biopython-dev
mailing list