run test with Unittests failed with error ImportError: No module named 'zipline.assets._assets'

191 views
Skip to first unread message

Ying Zou

unread,
Jun 28, 2016, 8:54:34 AM6/28/16
to Zipline Python Opensource Backtester
is it possible to run the unit test with Unittests or it can only run by nosetests?

Ying Zou

unread,
Jun 28, 2016, 9:39:34 AM6/28/16
to Zipline Python Opensource Backtester
when I use nosetests to run:
nosetests tests/data/bundles/test_yahoo.py:YahooBundleTestCase.test_bundle

I got the following error:
ImportError: No module named 'zipline.assets._assets'

在 2016年6月28日星期二 UTC+8下午8:54:34,Ying Zou写道:

Rich Frank

unread,
Jun 29, 2016, 9:33:31 AM6/29/16
to Zipline Python Opensource Backtester
That ImportError means python can't find the shared objects for zipline's C extensions.  Usually that just means you need to build them.  The easiest way to do that should be:

pip install -e <path to zipline repo>

We generally only run the tests with nosetests, so no guarantees, but I am currently able to run various test modules with unittest:

$ python -m unittest tests.test_labelarray
........
----------------------------------------------------------------------
Ran 8 tests in 0.136s

OK


I do have nosetests installed in my environment, so not sure if that's required for the above.

Also be aware that that particular test is currently failing on master.

Best,
Rich
Reply all
Reply to author
Forward
0 new messages