Neuroglycerin / neukrill-net-tools

Tools coded as part of the NDSB competition.
MIT License
0 stars 0 forks source link

Python version agnostic #31

Closed gngdb closed 9 years ago

gngdb commented 9 years ago

I'm giving in to Theano's tutorials Python 2 dependence. Want to be able to modify their code while expecting it to also run without problems. Can't easily do this in Python 3 as I have to fix a bunch of bugs. To get around this problem, making Python version agnostic allows us to use Python 2 without losing Python 3 support.

We don't really gain anything from using Python 3 in this case anyway.

fmaguire commented 9 years ago

Unittest is all kinds of fucked irritatingly: https://magnum.travis-ci.com/Neuroglycerin/neukrill-net-tools/jobs/12930022

Mock being reorganised is easily fixed with a try/except with import unittest.mock as mock and import mock

but I think the other failures are to do with the OOP changes.

gngdb commented 9 years ago

Somehow this is passing on my machine, just got rid of the mock import as I couldn't see where we were using. Probably not the best way to deal with it.

running test
running egg_info
writing requirements to neukrill_net.egg-info/requires.txt
writing neukrill_net.egg-info/PKG-INFO
writing top-level names to neukrill_net.egg-info/top_level.txt
writing dependency_links to neukrill_net.egg-info/dependency_links.txt
reading manifest file 'neukrill_net.egg-info/SOURCES.txt'
writing manifest file 'neukrill_net.egg-info/SOURCES.txt'
running build_ext
=============================== test session starts ================================
platform linux2 -- Python 2.7.9 -- py-1.4.26 -- pytest-2.6.4
collected 17 items 

neukrill_net/tests/test_image_processing.py .....
neukrill_net/tests/test_utils.py .......

============================ 17 passed in 1.45 seconds =============================
scottclowe commented 9 years ago

Presumably this means all future code will need to be Python2 and Python3 compatible. Is this the reason why the unit tests are failing on Travis?

gngdb commented 9 years ago

Yeah, annoyingly the bugs are in the tests. The testing libraries vary between the distributions. Finlay knows more about the details than me.

I think the code works fine on Python 2, it's just the tests. We should still fix them, obviously.

If it becomes hard to support Python 3 at all, we'll just drop it and use only Python 2.

scottclowe commented 9 years ago

A single call to super() was messing up the tests. They now run successfully for both Python 2 and 3 on Travis!