Commit cc1154d1 authored by holger krekel's avatar holger krekel

remove py/bin/py.test script because we neccessarily have at root level anyway.

the root is now a modified version of the file from the pytest distribution
because I want to disable warnings for people who have installed py.test indepedently
from PyPy. Also fix up the docs a bit more to hint / move towards this possibility.

also fix the docs to point to "" instead of "pypy/" which
should die at some point.
parent 59fee0e1
#!/usr/bin/env python
# find and import a version of 'py'
import sys
import os
from os.path import dirname as opd, exists, join, basename, abspath
def searchpy(current):
while 1:
last = current
initpy = join(current, '')
if not exists(initpy):
pydir = join(current, 'py')
# recognize py-package and ensure it is importable
if exists(pydir) and exists(join(pydir, '')):
#for p in sys.path:
# if p == current:
# return True
if current != sys.path[0]: # if we are already first, then ok
sys.stderr.write("inserting into sys.path: %s\n" % current)
sys.path.insert(0, current)
return True
current = opd(current)
if last == current:
return False
if not searchpy(abspath(os.curdir)):
if not searchpy(opd(abspath(sys.argv[0]))):
if not searchpy(opd(__file__)):
pass # let's hope it is just on sys.path
import py
if __name__ == '__main__':
print ("py lib is at %s" % py.__file__)
#!/usr/bin/env python
# XXX integrate into pypy/
# somewhat PYPY specific hack:
# let's make sure setuptools does show a warning when our inlined 'py'
# version shadows a properly installed one.
import warnings
"Module py was already imported", category=UserWarning)
"Module _pytest was already imported",
"Module pytest was already imported",
from _findpy import py
import pytest
......@@ -207,32 +207,52 @@ or start off at one of the following points:
Running PyPy's unit tests
The PyPy project uses test-driven-development. Right now, there are
a couple of different categories of tests which you can run.
To run all the unit tests::
PyPy development always was and is still thorougly test-driven.
We use the flexible `py.test testing tool`_ which you can `install independently
<>`_ and use indepedently
from PyPy for other projects.
cd pypy
The PyPy source tree comes with an inlined version of ``py.test``
which you can invoke by typing::
python -h
This is usually equivalent to using an installed version::
py.test -h
If you encounter problems with the installed version
make sure you have the correct version installed which
you can find out with the ``--version`` switch.
(this is not recommended, since it takes hours and uses huge amounts of RAM).
Alternatively, you may run subtests by going to the correct subdirectory
and running them individually::
Now on to running some tests. PyPy has many different test directories
and you can use shell completion to point at directories or files::
python interpreter/test/
py.test pypy/interpreter/test/
```` is actually just a synonym for `py.test`_ which is
our external testing tool. If you have installed that you
can as well just issue ``py.test DIRECTORY_OR_FILE`` in order
to perform test runs or simply start it without arguments to
run all tests below the current directory.
# or for running tests of a whole subdirectory
py.test pypy/interpreter/
Finally, there are the CPython regression tests which you can
run like this (this will take hours and hours and hours)::
See `py.test usage and invocations`_ for some more generic info
on how you can run tests.
cd lib-python/2.5.2/test
python ../../../pypy/
Beware trying to run "all" pypy tests by pointing to the root
directory or even the top level subdirectory ``pypy``. It takes
hours and uses huge amounts of RAM and is not recommended.
.. _`installed py.test`:
To run CPython regression tests you can point to the ``lib-python``
py.test lib-python/2.7.0/test/
This will usually take a long time because this will run
the PyPy Python interpreter on top of CPython. On the plus
side, it's usually still faster than doing a full translation
and running the regression test with the translated PyPy Python
.. _`py.test testing tool`:
.. _`py.test usage and invocations`:
Special Introspection Features of the Untranslated Python Interpreter
......@@ -345,14 +365,13 @@ the `download page of ctypes`_.
py.test and the py lib
The `py library`_ is used for supporting PyPy development and
running our tests against code and documentation as well as
compliance tests. You don't need to install the py library because
it ships with PyPy and `pypy/`_ is an alias for ``py.test``
but if you want to have the ``py.test`` tool generally in your
path, you might like to visit:
The `py.test testing tool`_ drives all our testing needs.
We use the `py library`_ for filesystem path manipulations, terminal
writing, logging and some other support functionality.
You don't neccessarily need to install these two libraries because
we also ship them inlined in the PyPy source tree.
Getting involved
......@@ -370,7 +389,7 @@ as EuroPython or Pycon. Upcoming events are usually announced on `the blog`_.
.. _`pypy-dev mailing list`:
.. _`contact possibilities`: index.html
.. _`py library`:
.. _`py library`:
.. _`Spidermonkey`:
......@@ -81,8 +81,6 @@ You can also have a look around our documentation_.
.. _`efficient propagators for specialized finite domains`:
.. _`py.test`:
.. _`py.execnet`:
.. _`object spaces`: objspace.html
.. _`code templating solution`:
unit and functional testing with Python.
(pypy version of startup script)
__version__ = '2.0.2.dev4'
__version__ = '2.0.2.dev5' # base pytest version
__all__ = ['main']
from _pytest.core import main, UsageError, _preloadplugins
from _pytest import core as cmdline
# This script is located in the pypy source tree
# which has a copy of pytest and py within its source tree.
# If the environment also has an installed version of pytest/py
# we are bound to get warnings so we disable them.
# XXX eventually pytest and py should not be inlined shipped
# with the pypy source code but become a requirement for installation.
import warnings
"Module py was already imported", category=UserWarning)
"Module _pytest was already imported",
"Module pytest was already imported",
if __name__ == '__main__': # if run as a script or by 'python -m pytest'
raise SystemExit(main())
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment