[Biopython-dev] test_PhyloXML.py on Python 3
Peter
biopython at maubp.freeserve.co.uk
Tue Aug 17 11:25:40 UTC 2010
On Tue, Aug 17, 2010 at 2:59 AM, Eric Talevich <eric.talevich at gmail.com> wrote:
>
> I can't seem to replicate these errors. Are they still occurring on your
> auto2to3 branch?
>
Yes - but I this this is down to it not being a clean branch - see below.
> From a clean master branch, I did:
>
> git checkout -b three
> 2to3 -w -x long Bio/
> 2to3 -w BioSQL/ Tests/ setup.py
> python3 setup.py build
> sudo python3 setup.py install
> cd Tests/
> python3 test_Phylo.py
> python3 test_PhyloXML.py
It doesn't matter for testing Bio.Phylo, but you shouldn't need to convert
setup.py, and you haven't converted the doctests. This is what we have in
the README file:
$ 2to3 --nofix=long --no-diffs -n -w Bio BioSQL Tests Scripts Doc/examples
$ 2to3 --nofix=long --no-diffs -n -w -d Bio BioSQL Tests Scripts Doc/examples
I've been running that with the addition of -j 7 to speed it up.
The good news is using the above 2to3 run on a clean branch fixes
test_PhyloXML.py, e.g.
git reset --hard
git checkout master
git checkout -b three
2to3 -j 7 --nofix=long --no-diffs -n -w Bio BioSQL Tests Scripts Doc/examples
2to3 -j 7 --nofix=long --no-diffs -n -w -d Bio BioSQL Tests Scripts Doc/examples
python3 setup.py install --prefix=$HOME
cd Tests
python3 test_Phylo.py
python3 test_PhyloXML.py
The resulting code is a little different from my auto2to3 branch - all to do
with long/int changes. I think my script was keeping the unwanted fixes to
Bio/Phylo/PhyloXML.py as well as the useful fixes made to these files:
* Bio/SeqIO/InsdcIO.py - testing for isinstance of int or long
* BioSQL/Loader.py - testing for isinstance of int or long
* Bio/Prosite/Prodoc.py - using long(handle.tell())
* Bio/Prosite/__init__.py - using long(handle.tell())
The bad news is running 2to3 on a clean branch with the long fixes
disabled breaks a few things where we need int/long fixes, e.g.
test_BioSQL.py via Bio/SeqIO/InsdcIO.py
I think we have three options,
(1) Manually fix the int/long issues in the four files listed, and continue
to use 2to3 with the long fixer disabled. The long(handle.tell()) call can
just be handle.tell() as far as I can see (at least on Python 3), and
Bio.Prosite is deprecated anyway. For the other issue we can add an
is_int_or_long function in our Python 3 compatibility library, which I
think I can do without trouble.
(2) Manually fix PhyloXML to avoid long for longitude (with a deprecation
period etc), and go back to using 2to3 with default settings. A bit of a pain.
(3) Don't change the code, but run 2to3 in default mode for most cost,
while disabling the long fixer for Bio/Phylo - this will require scripting.
I think option (1) makes most sense.
Peter
P.S.
I also need to look at my auto2to3 script again to prevent auto merges.
The simple answer is to create a clean branch each time (perhaps
deleting or replacing the old conversions)... the auto2to3 branch was
for testing purposes anyway so I don't mind deleting it.
More information about the Biopython-dev
mailing list