4.0.2 merge 

better support for macs, increases test coverage, uses py.test