2009-07-21 00:54:08 +08:00
|
|
|
..
|
|
|
|
==============
|
|
|
|
Downloading
|
|
|
|
==============
|
2009-04-02 15:10:16 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
.. _`PyPI project page`: http://pypi.python.org/pypi/py/
|
2009-06-19 19:05:44 +08:00
|
|
|
|
2009-06-19 18:19:59 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
py.test/pylib compat/install info in a nutshell
|
2008-08-16 23:26:59 +08:00
|
|
|
===================================================
|
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
PyPI Pyckage name: "**py**", see `PyPI project page`_ for latest version
|
|
|
|
|
|
|
|
Installers: easy_install_ and pip_, setuptools_ or Distribute_
|
|
|
|
|
|
|
|
Pythons: 2.4, 2.5, 2.6, 3.0, 3.1, Jython-2.5.1, PyPy-1.1
|
|
|
|
|
|
|
|
Operating systems: Linux, Windows and OSX + probably many others
|
|
|
|
|
|
|
|
|
|
|
|
Best practise: install tool and dependencies virtually
|
|
|
|
===========================================================
|
|
|
|
|
|
|
|
It is recommended to work with virtual environments
|
|
|
|
(e.g. virtualenv_ or buildout_ based) and use easy_install_
|
|
|
|
(or pip_) for installing py.test/pylib and any dependencies
|
|
|
|
you need to run your tests. Local virtual Python environments
|
|
|
|
(as opposed to system-wide "global" environments) make for a more
|
|
|
|
reproducible and reliable test environment.
|
|
|
|
|
|
|
|
Note: as of November 2009 pytest/pylib 1.1 RPMs and DEB packages
|
|
|
|
are not available. If you want to easy_install the newest py.test
|
|
|
|
and pylib do everyone a favour and uninstall older versions
|
|
|
|
from the global system e.g. like this on Ubuntu::
|
|
|
|
|
|
|
|
sudo apt-get remove --purge python-codespeak-lib
|
|
|
|
|
|
|
|
.. _`virtualenv`: http://pypi.python.org/pypi/virtualenv
|
|
|
|
.. _`buildout`: http://www.buildout.org/
|
|
|
|
.. _pip: http://pypi.python.org/pypi/pip
|
|
|
|
.. _`easy_install`:
|
|
|
|
|
|
|
|
using easy_install (from setuptools or Distribute)
|
|
|
|
===================================================
|
|
|
|
|
|
|
|
Both `Distribute`_ and setuptools_ provide the ``easy_install``
|
|
|
|
installation tool. While setuptools should work ok with
|
|
|
|
Python2 interpreters, `Distribute`_ also works with Python3
|
|
|
|
and it avoids some issues on Windows. In both cases you
|
|
|
|
can open a command line window and then type::
|
2009-06-30 18:42:57 +08:00
|
|
|
|
2008-08-30 02:55:42 +08:00
|
|
|
easy_install -U py
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
to install the latest release of the py lib and py.test. The ``-U`` switch
|
2008-08-30 02:55:42 +08:00
|
|
|
will trigger an upgrade if you already have an older version installed.
|
2009-11-02 20:00:48 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
If you now type::
|
|
|
|
|
|
|
|
py.test --version
|
|
|
|
|
|
|
|
you should see the version number and the import location of the tool.
|
|
|
|
Maybe you want to head on with the `quickstart`_ now?
|
|
|
|
|
|
|
|
.. _quickstart: test/quickstart.html
|
|
|
|
|
|
|
|
Troubleshooting
|
|
|
|
========================
|
|
|
|
|
|
|
|
**On Linux**: If ``easy_install`` fails because it needs to run
|
|
|
|
as the superuser you are trying to install things globally
|
|
|
|
and need to put ``sudo`` in front of the command.
|
|
|
|
|
|
|
|
**On Windows**: If "easy_install" or "py.test" are not found
|
|
|
|
please see here: `How do i run a Python program under Windows?`_
|
|
|
|
|
|
|
|
.. _`How do i run a Python program under Windows?`: http://www.python.org/doc/faq/windows/#how-do-i-run-a-python-program-under-windows
|
2009-06-30 18:42:57 +08:00
|
|
|
|
2009-08-19 01:04:57 +08:00
|
|
|
.. _mercurial: http://mercurial.selenic.com/wiki/
|
2009-11-02 20:00:48 +08:00
|
|
|
.. _`Distribute`:
|
|
|
|
.. _`Distribute for installation`: http://pypi.python.org/pypi/distribute#installation-instructions
|
2009-09-07 23:53:50 +08:00
|
|
|
.. _`distribute installation`: http://pypi.python.org/pypi/distribute
|
2009-08-19 01:04:57 +08:00
|
|
|
.. _checkout:
|
|
|
|
.. _tarball:
|
2008-09-23 22:42:27 +08:00
|
|
|
|
2009-08-19 01:04:57 +08:00
|
|
|
Working from version control or a tarball
|
2009-07-15 03:17:13 +08:00
|
|
|
=================================================
|
2008-09-23 22:42:27 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
To follow development or start experiments, checkout the
|
|
|
|
complete code and documentation source with mercurial_::
|
2008-09-23 22:42:27 +08:00
|
|
|
|
2009-07-15 03:17:13 +08:00
|
|
|
hg clone https://bitbucket.org/hpk42/py-trunk/
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-11-13 04:15:59 +08:00
|
|
|
Development takes place on the 'trunk' branch.
|
2009-06-30 18:42:57 +08:00
|
|
|
|
2009-11-05 10:18:55 +08:00
|
|
|
You can also go to the python package index and
|
2009-08-19 01:04:57 +08:00
|
|
|
download and unpack a TAR file::
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-08-19 01:04:57 +08:00
|
|
|
http://pypi.python.org/pypi/py/
|
2009-07-21 00:54:08 +08:00
|
|
|
|
2009-11-02 20:00:48 +08:00
|
|
|
|
|
|
|
activating a checkout with setuptools
|
2009-08-19 01:04:57 +08:00
|
|
|
--------------------------------------------
|
|
|
|
|
2009-11-02 20:00:48 +08:00
|
|
|
With a working `Distribute`_ or setuptools_ installation you can type::
|
2009-08-19 01:04:57 +08:00
|
|
|
|
|
|
|
python setup.py develop
|
|
|
|
|
2009-11-05 10:18:55 +08:00
|
|
|
in order to work inline with the tools and the lib of your checkout.
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-07-21 00:54:08 +08:00
|
|
|
.. _`no-setuptools`:
|
|
|
|
|
2009-11-02 20:00:48 +08:00
|
|
|
.. _`directly use a checkout`:
|
2009-08-19 01:04:57 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
directly use a checkout or tarball
|
2009-11-02 20:00:48 +08:00
|
|
|
-------------------------------------------------------------
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
Once you got yourself a checkout_ or tarball_ it is usually a good
|
|
|
|
idea to add the parent directory of the ``py`` package directory
|
|
|
|
to your ``PYTHONPATH`` and ``py/bin`` or ``py\bin\win32`` to your
|
|
|
|
system wide ``PATH`` settings. There are helper scripts that
|
|
|
|
set ``PYTHONPATH`` and ``PATH`` on your system:
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-08-19 01:04:57 +08:00
|
|
|
on windows execute::
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-08-19 01:04:57 +08:00
|
|
|
# inside autoexec.bat or shell startup
|
2009-11-02 20:00:48 +08:00
|
|
|
c:\\path\to\checkout\bin\env.cmd
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-08-19 01:04:57 +08:00
|
|
|
on linux/OSX add this to your shell initialization::
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-08-19 01:04:57 +08:00
|
|
|
# inside .bashrc
|
2009-11-02 20:00:48 +08:00
|
|
|
eval `python ~/path/to/checkout/bin/env.py`
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-07-15 03:17:13 +08:00
|
|
|
both of which which will get you good settings
|
|
|
|
for ``PYTHONPATH`` and ``PATH``.
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
If you install ``py.test`` this way you can easily
|
|
|
|
``hg pull && hg up`` your checkout to follow the
|
|
|
|
development tree.
|
2009-08-19 01:04:57 +08:00
|
|
|
|
|
|
|
note: scripts look for "nearby" py-lib
|
|
|
|
-----------------------------------------------------
|
|
|
|
|
2009-11-02 20:00:48 +08:00
|
|
|
Note that all `command line scripts`_ will look
|
2009-07-15 03:17:13 +08:00
|
|
|
for "nearby" py libs, so if you have a layout like this::
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-07-15 03:17:13 +08:00
|
|
|
mypkg/
|
|
|
|
subpkg1/
|
|
|
|
tests/
|
|
|
|
tests/
|
|
|
|
py/
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-08-19 01:04:57 +08:00
|
|
|
issuing ``py.test subpkg1`` will use the py lib
|
2009-11-06 00:46:14 +08:00
|
|
|
from that projects root directory. Giving the
|
|
|
|
state of Python packaging there can be confusion
|
|
|
|
in which case issuing::
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
py.test --version
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
tells you both version and import location of the tool.
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-11-06 00:46:14 +08:00
|
|
|
.. _`command line scripts`: bin.html
|
2009-08-19 01:04:57 +08:00
|
|
|
.. _contact: contact.html
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-07-15 03:17:13 +08:00
|
|
|
.. _`RPM`: http://translate.sourceforge.net/releases/testing/fedora/pylib-0.9.2-1.fc9.noarch.rpm
|
2008-08-16 23:26:59 +08:00
|
|
|
|
2009-11-02 20:00:48 +08:00
|
|
|
.. _`setuptools`: http://pypi.python.org/pypi/setuptools
|
2008-08-22 21:41:17 +08:00
|
|
|
|