[py-svn] r6957 - in py/dist/py: . bin test

hpk at codespeak.net hpk at codespeak.net
Sat Oct 16 02:46:47 CEST 2004


Author: hpk
Date: Sat Oct 16 02:46:46 2004
New Revision: 6957

Added:
   py/dist/py/bin/_findpy.py
      - copied, changed from r6954, py/dist/py/bin/_findstd.py
   py/dist/py/pytest.py
      - copied, changed from r6954, py/dist/py/pytest.conf
Removed:
   py/dist/py/bin/_findstd.py
   py/dist/py/pytest.conf
Modified:
   py/dist/py/bin/py.test
   py/dist/py/test/cmdline.py
   py/dist/py/test/config.py
Log:

- cleaned up the startup of py.test 

- slowly approaching a refactoring of the configuration 
  mess^h^h^hmechanism of py.test 
 


Copied: py/dist/py/bin/_findpy.py (from r6954, py/dist/py/bin/_findstd.py)
==============================================================================
--- py/dist/py/bin/_findstd.py	(original)
+++ py/dist/py/bin/_findpy.py	Sat Oct 16 02:46:46 2004
@@ -1,25 +1,31 @@
-# Detect nearestby version of 'std'
+#
+# find and import a version of 'py' 
 # 
-import sys, os 
+import sys
+import os
 from os.path import dirname as opd, exists, join, basename, abspath 
 
-def searchstd(current):
+def searchpy(current):
     while 1:
         last = current
         initpy = join(current, '__init__.py') 
         if not exists(initpy): 
-            stddir = join(current, 'py') 
-            # recognize std-package and make it importable first thing 
-            if exists(stddir) and exists(join(stddir, '__init__.py')): 
-                sys.path[:] = [p for p in sys.path if p != current] 
-                print "inserting", current
+            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 
+                print "inserting into sys.path:", current
                 sys.path.insert(0, current) 
                 return True
         current = opd(current) 
         if last == current: 
             return False 
 
-if not searchstd(abspath(os.curdir)):
-    if not searchstd(opd(abspath(sys.argv[0]))):
-        if not searchstd(opd(__file__)):
+if not searchpy(abspath(os.curdir)):
+    if not searchpy(opd(abspath(sys.argv[0]))):
+        if not searchpy(opd(__file__)):
             raise SystemExit, "Could not find 'py' package!"
+
+import py

Deleted: /py/dist/py/bin/_findstd.py
==============================================================================
--- /py/dist/py/bin/_findstd.py	Sat Oct 16 02:46:46 2004
+++ (empty file)
@@ -1,25 +0,0 @@
-# Detect nearestby version of 'std'
-# 
-import sys, os 
-from os.path import dirname as opd, exists, join, basename, abspath 
-
-def searchstd(current):
-    while 1:
-        last = current
-        initpy = join(current, '__init__.py') 
-        if not exists(initpy): 
-            stddir = join(current, 'py') 
-            # recognize std-package and make it importable first thing 
-            if exists(stddir) and exists(join(stddir, '__init__.py')): 
-                sys.path[:] = [p for p in sys.path if p != current] 
-                print "inserting", current
-                sys.path.insert(0, current) 
-                return True
-        current = opd(current) 
-        if last == current: 
-            return False 
-
-if not searchstd(abspath(os.curdir)):
-    if not searchstd(opd(abspath(sys.argv[0]))):
-        if not searchstd(opd(__file__)):
-            raise SystemExit, "Could not find 'py' package!"

Modified: py/dist/py/bin/py.test
==============================================================================
--- py/dist/py/bin/py.test	(original)
+++ py/dist/py/bin/py.test	Sat Oct 16 02:46:46 2004
@@ -1,8 +1,5 @@
 #!/usr/bin/env python 
 
-import _findstd 
+from _findpy import py 
 import sys
-# we now can import (a version of) std 
-
-from py.test import main
-main(sys.argv)
+py.test.main(sys.argv)

Deleted: /py/dist/py/pytest.conf
==============================================================================
--- /py/dist/py/pytest.conf	Sat Oct 16 02:46:46 2004
+++ (empty file)
@@ -1,10 +0,0 @@
-# standard options (modified from cmdline) 
-#pythonexecutable = 'python2.2'
-
-verbose = 0 
-nocapture = False 
-collectonly = False 
-exitfirstproblem = False 
-fulltrace = False 
-showlocals = False
-nomagic = False 

Copied: py/dist/py/pytest.py (from r6954, py/dist/py/pytest.conf)
==============================================================================
--- py/dist/py/pytest.conf	(original)
+++ py/dist/py/pytest.py	Sat Oct 16 02:46:46 2004
@@ -1,6 +1,15 @@
-# standard options (modified from cmdline) 
-#pythonexecutable = 'python2.2'
+#pythonexecutables = ('python2.2', 'python2.3',) 
+pythonexecutable = 'python2.2' 
 
+def setup_module(extpy):
+    mod = extpy.resolve() 
+    mod.module = 23
+    directory = pypath.root.dirpath()
+    
+    
+    
+    
+# standard options (modified from cmdline) 
 verbose = 0 
 nocapture = False 
 collectonly = False 

Modified: py/dist/py/test/cmdline.py
==============================================================================
--- py/dist/py/test/cmdline.py	(original)
+++ py/dist/py/test/cmdline.py	Sat Oct 16 02:46:46 2004
@@ -6,7 +6,7 @@
 #
 # main entry point
 #
-configbasename = 'utest.conf' 
+configbasename = 'pytest.py' 
 
 def main(argv=None):
     # the collectors we will be running
@@ -17,8 +17,9 @@
         name = frame.f_locals.get('__name__')
         if name != '__main__':
             return # called from an imported test file
-            #raise RuntimeError, "Must provide 'argv' parameter" 
-        collectors.append(test.collect.Module('__main__'))
+        import __main__
+        collectors.append(test.collect.Module(__main__)) 
+        
     args = argv[1:]
     for x in getanchors(args):
         config.readconfiguration(x) 

Modified: py/dist/py/test/config.py
==============================================================================
--- py/dist/py/test/config.py	(original)
+++ py/dist/py/test/config.py	Sat Oct 16 02:46:46 2004
@@ -8,7 +8,7 @@
 #
 # config file handling (utest.conf)
 #
-configbasename = 'pytest.conf' 
+configbasename = 'pytest.py' 
 
 class Config:
     def __init__(self):



More information about the pytest-commit mailing list