UDST / spandex

Spatial Analysis and Data Extraction
http://nbviewer.ipython.org/github/synthicity/user_meeting_2014/blob/gh-pages/spandex/spandex_demo.ipynb
BSD 3-Clause "New" or "Revised" License
22 stars 7 forks source link

test_tableframe test fails #54

Closed tbuckl closed 9 years ago

tbuckl commented 9 years ago

In this environment, which is as close to the travis config in the repo as i could get, https://github.com/MetropolitanTransportationCommission/bayarea_urbansim_setup/tree/vagrant-ubuntu14-giuliani

test_tableframe fails.

vagrant@vagrant-ubuntu-trusty-64:/vm_project_dir/spandex$ py.test --cov "/home/vagrant/miniconda/lib/python2.7/sit
e-packages/spandex" --cov-report term-missing
=============================================== test session starts ===============================================
platform linux2 -- Python 2.7.9 -- py-1.4.27 -- pytest-2.7.1
rootdir: /home/vagrant/miniconda/lib/python2.7/site-packages, inifile:
plugins: cov
collected 74 items

../../home/vagrant/miniconda/lib/python2.7/site-packages ...................................................................Fs.....Coverage.py warning: Module /home/vagrant/miniconda/lib/python2.7/site-packages/spandex was never imported.
Coverage.py warning: No data was collected.

==================================================== FAILURES =====================================================
_________________________________________________ test_tableframe _________________________________________________

loader = <spandex.io.TableLoader object at 0x7fe4f1088390>

    def test_tableframe(loader):
        table = loader.tables.sample.hf_bg
        for cache in [False, True]:
            tf = TableFrame(table, index_col='gid', cache=cache)
>           assert isinstance(tf.index, pd.Index)

spandex/tests/test_io.py:14:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
spandex/io.py:483: in index
    index_col=self._index_col).index
spandex/io.py:741: in db_to_df
    q = db_to_query(query)
spandex/io.py:672: in db_to_query
    return sess.query(*orm)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe4f07ee110>

>   ???
E   NotImplementedError: Class <class 'sqlalchemy.orm.attributes.InstrumentedAttribute'> is not iterable

build/bdist.linux-x86_64/egg/sqlalchemy/sql/operators.py:316: NotImplementedError
--------------------------------- coverage: platform linux2, python 2.7.9-final-0 ---------------------------------
Name    Stmts   Miss  Cover   Missing
-------------------------------------
================================= 1 failed, 72 passed, 1 skipped in 32.30 seconds =================================
janowicz commented 9 years ago

Updated setup.py to specify sqlalchemy version 0.9.9. Versions of sqlalchemy between 0.8.7 and 0.9.9 work (test_io passes, and bayarea_urbansim data regeneration scripts run). Version 1.0.0 (just released) and onwards do not due to a recent breaking change. Version 0.8.0 and prior do not. Tested this on a Windows 7 machine and an Ubuntu 14.04 machine. Let me know if this is the case in your environment too. I was able to recreate the test_io failure you posted above on both machines.

When we met on Wednesday, we specified a previous version of sqlalchemy when encountering problems with a machine on v1.0.0+. This motivated the change to 0.8.0, but we went too far back. Stay in the 0.8.7 - 0.9.9 range :)

http://docs.sqlalchemy.org/en/rel_1_0/changelog/migration_10.html