The test suite is installed as a sub-package, so the test data must also be installed along with it.
The `__file__` attribute can be missing when importing a zipped package, so we load test files with `pkg_resources.resource_filename()`.
`random.randint`, which is used in `cu2qu.benchmark.generate_curve` function, yields
different results when run in Python 2.7 or 3, despite using the same `random.seed(1)`.
For this reason, the `test_results_unchanged` and `test_results_unchanged_multiple` tests
in `cu2qu_test` module fail when run under Python 2.
Backward compatibility was broken with Python 3.2 `random` module, as a side effect of
fixing a non-uniformity bug. For mor info see:
https://groups.google.com/forum/#!topic/comp.lang.python/KwALjKjF6Y4http://bugs.python.org/issue9025
To work around this, I dumped the result of generate_curve (running from Python 3.5.2 on
OSX) to a json file, and use that to run the tests.
I also stripped the white space to reduce the file size.
```python
import random
import json
from cu2qu.benchmark import generate_curve
random.seed(1)
curves = [generate_curve() for i in range(1000)]
with open("Lib/cu2qu/test/data/curves.json", "w") as fp:
fp.write(json.dumps(curves).replace(" ", ""))
```
fixup
For some reason, I was subtracting 1 from the spline lengths in the
test report. Not sure why that is, so I've assumed it was wrong (and
now we subtract 2 to get the length in number of segments).
This reverts commit 79beda96a4e26d5d1778f24de673cf14c6bda1ac.
Apparently now Travis expects what my local machine expects. I swear,
Travis is messing with me....