Fix upload on python >= 2.7.9 and >= 3.4.2

http://bugs.python.org/issue10510 fix HTML compliance of distutils
upload requests.

See the changeset on python 2.7: https://hg.python.org/cpython/rev/9ad78b4b169c

This will be released in 2.7.9 and is already relased in 3.4.2.

Localshop needs to handle both methods.


Also, I've done some refactoring on tests (more pytest style)