Solution was as follows:
Create separate .travis_requirements.txt without the pygame.
Change .travis.yml
as follows:
language: python
python:
- "2.7"
before_install:
- sudo apt-get update -qq
- sudo apt-get build-dep -qq python-pygame
- sudo apt-get install -qq python-pygame
install:
- pip install -r .travis_requirements.txt
script:
- nosetests tests/*.py
virtualenv:
system_site_packages: true
Main change is using "system_site_packages" setting and installing pygame via apt-get.