Skip to content

Test Environment Setup

waylan edited this page Mar 7, 2013 · 15 revisions

Python-Markdown uses nose and tox for tests. Tox allows the nose tests to easily be run in all supported versions of Python. For that to work, all supported versions of Python need to be installed on the system. Then the testing tools need to be installed.

These instructions assume a typical Ubuntu Linux system.

Installing Multiple Python Versions

The simplest approach is to install from source into /opt. Apparently, /opt is where one would install optional packages. Additionally, by installing from source with the changed location, each Python version would be completely contained within a directory within /opt. If one ever wants to remove a version, all one needs to do is delete that directory and any associated links.

The first step is to ensure that all dependencies are installed for the currently installed Python version. Run the following once:

$ python --version
Python 2.7.2+
$ sudo apt-get build-dep python2.7

That will install a bunch of dev packages. Which packages get installed will likely depend of each specific system.

The following commands will need to be repeated for each version of Python not already installed. Be sure to replace the X's with the appropriate version numbers. The various versions and download links can be found on the Python download page.

$ wget http://python.org/ftp/python/X.X.X/Python-X.X.X.tgz
$ tar xvfz Python-X.X.X.tgz
$ cd Python-X.X.X
$ ./configure --prefix=/opt/pythonX.X
$ make
$ sudo make install

Of course, these need to be on the path to be useful so create some links:

$ sudo ln -s /opt/pythonX.X/bin/pythonX.X /usr/bin/pythonX.X

While Python-Markdown no longer uses the 2to3 conversion tool, it may be helpful anyway:

$ sudo ln -s /opt/python3.3/bin/2to3 /usr/bin/2to3

It is recommended that 2to3 only be linked once for the most recent version. It's not likely needed for every version of Python.

Installing the Testing Tools

Coming soon...