Commit cc1154d1 authored by holger krekel's avatar holger krekel

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

the root pytest.py 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 "pytest.py" instead of "pypy/test_all.py" 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, '__init__.py')
if not exists(initpy):
pydir = join(current, 'py')
# recognize py-package and ensure it is importable
if exists(pydir) and exists(join(pydir, '__init__.py')):
#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/test_all.py
# 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
warnings.filterwarnings("ignore",
"Module py was already imported", category=UserWarning)
warnings.filterwarnings("ignore",
"Module _pytest was already imported",
category=UserWarning)
warnings.filterwarnings("ignore",
"Module pytest was already imported",
category=UserWarning)
from _findpy import py
import pytest
pytest.main()
......@@ -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
<http://pytest.org/getting-started.html>`_ and use indepedently
from PyPy for other projects.
cd pypy
python test_all.py
The PyPy source tree comes with an inlined version of ``py.test``
which you can invoke by typing::
python pytest.py -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 test_all.py interpreter/test/test_pyframe.py
py.test pypy/interpreter/test/test_pyframe.py
``test_all.py`` 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/test_all.py
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`: https://codespeak.net/py/current/doc/download.html
To run CPython regression tests you can point to the ``lib-python``
directory::
py.test lib-python/2.7.0/test/test_datetime.py
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
interpreter.
.. _`py.test testing tool`: http://pytest.org
.. _`py.test usage and invocations`: http://pytest.org/usage.html#usage
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/test_all.py`_ 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.
http://codespeak.net/py/dist/download.html
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`: http://codespeak.net/mailman/listinfo/pypy-dev
.. _`contact possibilities`: index.html
.. _`py library`: http://codespeak.net/py
.. _`py library`: http://pylib.org
.. _`Spidermonkey`: http://www.mozilla.org/js/spidermonkey/
......
......@@ -81,8 +81,6 @@ You can also have a look around our documentation_.
.. _`efficient propagators for specialized finite domains`: http://codespeak.net/svn/pypy/extradoc/soc-2006/constraints.txt
.. _`py.test`: http://codespeak.net/py/current/doc/test.html
.. _`py.execnet`: http://codespeak.net/py/current/doc/execnet.html
.. _`object spaces`: objspace.html
.. _`code templating solution`: http://codespeak.net/svn/pypy/extradoc/soc-2006/code-templating.txt
......
"""
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 pytest.py 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
warnings.filterwarnings("ignore",
"Module py was already imported", category=UserWarning)
warnings.filterwarnings("ignore",
"Module _pytest was already imported",
category=UserWarning)
warnings.filterwarnings("ignore",
"Module pytest was already imported",
category=UserWarning)
if __name__ == '__main__': # if run as a script or by 'python -m pytest'
raise SystemExit(main())
else:
......
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