[pypy-svn] pypy pytest2: remove py/bin/py.test script because we neccessarily have pytest.py at root level anyway.

hpk42 commits-noreply at bitbucket.org
Sun Mar 6 19:37:35 CET 2011

Author: holger krekel <holger at merlinux.eu>
Branch: pytest2
Changeset: r42446:cc8117bbdad0
Date: 2011-03-06 19:36 +0100

Log:	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

	also fix the docs to point to "pytest.py" instead of
	"pypy/test_all.py" which should die at some point.

diff --git a/py/bin/py.test b/py/bin/py.test
deleted file mode 100755
--- a/py/bin/py.test
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/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
-    "Module py was already imported", category=UserWarning)
-    "Module _pytest was already imported",
-    category=UserWarning)
-    "Module pytest was already imported",
-    category=UserWarning)
-from _findpy import py
-import pytest

diff --git a/pypy/doc/project-ideas.txt b/pypy/doc/project-ideas.txt
--- a/pypy/doc/project-ideas.txt
+++ b/pypy/doc/project-ideas.txt
@@ -81,8 +81,6 @@
 .. _`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

diff --git a/py/bin/_findpy.py b/py/bin/_findpy.py
deleted file mode 100644
--- a/py/bin/_findpy.py
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/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__)

diff --git a/pypy/doc/getting-started-dev.txt b/pypy/doc/getting-started-dev.txt
--- a/pypy/doc/getting-started-dev.txt
+++ b/pypy/doc/getting-started-dev.txt
@@ -207,32 +207,52 @@
 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::
-(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::
+    python pytest.py -h
-    python test_all.py interpreter/test/test_pyframe.py
+This is usually equivalent to using an installed version::
-``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. 
+    py.test -h
-Finally, there are the CPython regression tests which you can 
-run like this (this will take hours and hours and hours)::
+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.
-    cd lib-python/2.5.2/test 
-    python ../../../pypy/test_all.py
+Now on to running some tests.  PyPy has many different test directories
+and you can use shell completion to point at directories or files::
-.. _`installed py.test`: https://codespeak.net/py/current/doc/download.html
+    py.test pypy/interpreter/test/test_pyframe.py
+    # or for running tests of a whole subdirectory
+    py.test pypy/interpreter/
+See `py.test usage and invocations`_ for some more generic info 
+on how you can run tests.
+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.
+To run CPython regression tests you can point to the ``lib-python``
+    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
+.. _`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 @@
 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.
-    http://codespeak.net/py/dist/download.html
+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 @@
 .. _`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/

diff --git a/pytest.py b/pytest.py
--- a/pytest.py
+++ b/pytest.py
@@ -1,12 +1,30 @@
 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
+    "Module py was already imported", category=UserWarning)
+    "Module _pytest was already imported",
+    category=UserWarning)
+    "Module pytest was already imported",
+    category=UserWarning)
 if __name__ == '__main__': # if run as a script or by 'python -m pytest'
     raise SystemExit(main())

More information about the Pypy-commit mailing list