More caching fixes
Added first test with py.test