Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.
samyboy edited this page Sep 26, 2014 · 13 revisions

For branch classes.unittests: How to create virtualenvs and execute unit tests.

install dev tools

sudo apt-get install zlib1g-dev libssl-dev python-dev

Install Python 2.4

The support for python2.4 was dropped in virtualenv 1.8 therefore make sure you use virtualenv<=1.7.2. https://pypi.python.org/pypi/virtualenv/1.7.2

  • Install python 2.4 from source
wget https://www.python.org/ftp/python/2.4.6/Python-2.4.6.tgz
tar xzf Python-2.4.6.tgz
cd Python-2.4.6
make clean
# Problem with creation of virtualenv:  ImportError: No module named 'zlib'
# Solution: Edit Modules/Setup to enable zlib (--with-zlib flag is not necessary)
./configure --prefix=$HOME/.local --with-ssl
make
make install
  • Install a virtual environment
virtualenv --python=$HOME/.local/bin/python2.4 ~/.virtualenv/env-2.4
  • Install modules in the virtualenv
source ~/.virtualenv/env-2.4/bin/activate
pip install pep8 # does not seem to work behind proxy
deactivate

Install Python 2.7.3 (used by Ubuntu 12.04)

wget https://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
tar xzf Python-2.7.3.tgz
cd Python-2.7.3
make clean
./configure --prefix=$HOME/.local --with-ssl
make
make install
  • Install a virtual environment
virtualenv ~/.virtualenv/env-2.7.3
  • Install the modules in the virtual environment
source ~/.virtualenv/venv-2.7.3/bin/activate
pip install pep8 # does not seem to work behind proxy
deactivate

Install Python 3.4

  • Install Python 3.4 from source
wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tgz
cd Python-3.4.1
make clean
# Problem with creation of virtualenv: ImportError: No module named '_collections_abc'
# Solution: User virtualenv version 1.11
./configure --prefix=/home/skrieg/.local
make
make install
  • Install a virtual environment
~/.local/bin/pyvenv-3.4 ~/.virtualenv/pyvenv-3.4
  • Install modules in the virtualenv
source ~/.virtualenv/pyvenv-3.4/bin/activate
pip install pep8 # does not seem to work behind proxy
deactivate

Clean the stuff

/bin/rm ~/.local/bin/python

##Execute tests

# test for system installed python
./unittests/unittests.py
# test for Python 2.4
source ~/.virtualenv/env-2.4/bin/activate
./unittests/unittests.py
deactivate
# test for Python 3.4
source ~/.virtualenv/pyvenv-3.4/bin/activate
./unittests/unittests.py
deactivate
Clone this wiki locally