rbarrois/factory_boy — pull request #20 by msabramo (2012-07-10 04:40:07+00:00)
Title: Python 3 compatibility tweaks

These changes enable Python 3 compatibility by moving setup.py from distutils to distribute and utilizing its `use_2to3` features to do most of the Python 3 changes on the fly. A few other mods were needed like moving the `tests` into `factory` which facilitates using 2to3 to translate the tests and changing from using the `cmp` argument of `sorted` to the new `key` argument. With these changes, I get two test failures with Python 3.2 under `tox` -- I didn't get a chance to debug them so I haven't yet added `3.2` to the `.travis.yml` file.

```
~/dev/git-repos/factory_boy$ tox -e py32
...
======================================================================
FAIL: test_infinite_iterator_list_comprehension (factory.tests.test_using.IteratorTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/marca/dev/git-repos/factory_boy/build/lib/factory/tests/test_using.py", line 827, in test_infinite_iterator_list_comprehension
self.assertRaises(TypeError, TestObjectFactory.build)
AssertionError: TypeError not raised by build

======================================================================
FAIL: test_infinite_iterator_list_comprehension (factory.tests.test_using.IteratorTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/marca/dev/git-repos/factory_boy/build/lib/factory/tests/test_using.py", line 827, in test_infinite_iterator_list_comprehension
self.assertRaises(TypeError, TestObjectFactory.build)
AssertionError: TypeError not raised by build

----------------------------------------------------------------------
Ran 256 tests in 0.163s

FAILED (failures=2)
ERROR: InvocationError: '/Users/marca/dev/git-repos/factory_boy/.tox/py32/bin/python setup.py test'
_________________________________________________________________________ summary __________________________________________________________________________
ERROR: py32: commands failed
```