Make running tests easier

Add the parent directory to the system path before importing pyaml when running
tests

This makes sure that the tests will be run on the local pyaml version, not the
system installed one.
Fix test case failure due to sorting

Python 3 won't do ordered comparisons between types, breaking the flatten
function which attempts to sort a list containing multiple types of elements.

The compare function (from https://gist.github.com/pR0Ps/1e1a1e892aad5b691448)
restores the old functionality in Python 3, while remaining backwards
compatible with Python 2.