OpenTreeMap / otm-core

OpenTreeMap is a collaborative platform for crowdsourced tree inventory, ecosystem services calculations, urban forestry analysis, and community engagement.
www.opentreemap.org
Other
186 stars 88 forks source link

Fix importer app tests #3292

Closed fungjj92 closed 4 years ago

fungjj92 commented 4 years ago

Overview

This PR fixes failing unit tests in the importer django app. Same old story as other PRs, all unit test failures continue to be because of the clarification between Binary vs Unicode encoding.

The more interesting case seen here is that CSV generation is more strict. Before, a temporary file wrapper of a byte stream was considered a valid csv file. Now, it is not. A valid csv file must be an iterator object of unicode strings. So there's a bit of conversion we do to repackage the byte stream into a proper csv. I left an in-line comment that I hope is clear. Let me know if it could be made clearer: in-line comments tend to be particularly helpful in infrequently touched codebases like this.

Testing

./scripts/manage.sh test importer should run cleanly and only treemap tests should be broken 🌮

Ran 1121 tests in 309.863s

FAILED (failures=18, errors=11, skipped=23)