[py-svn] r61774 - in py/branch/pytestplugin/py: . misc/testing
hpk at codespeak.net
hpk at codespeak.net
Thu Feb 12 12:36:23 CET 2009
Author: hpk
Date: Thu Feb 12 12:36:21 2009
New Revision: 61774
Modified:
py/branch/pytestplugin/py/__init__.py
py/branch/pytestplugin/py/initpkg.py
py/branch/pytestplugin/py/misc/testing/test_initpkg.py
Log:
no need to hide that py lib module are a bit special.
Modified: py/branch/pytestplugin/py/__init__.py
==============================================================================
--- py/branch/pytestplugin/py/__init__.py (original)
+++ py/branch/pytestplugin/py/__init__.py Thu Feb 12 12:36:21 2009
@@ -1,7 +1,8 @@
# -*- coding: utf-8 -*-
"""
-The py lib is a development support library featuring these tools and APIs:
+The py lib is an extensible library for testing, distributed processing and
+interacting with filesystems.
- `py.test`_: cross-project testing tool with many advanced features
- `py.execnet`_: ad-hoc code distribution to SSH, Socket and local sub processes
@@ -37,7 +38,7 @@
author_email = "holger at merlinux.eu, py-dev at codespeak.net",
long_description = globals()['__doc__'],
classifiers = [
- "Development Status :: 4 - Beta",
+ "Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX",
Modified: py/branch/pytestplugin/py/initpkg.py
==============================================================================
--- py/branch/pytestplugin/py/initpkg.py (original)
+++ py/branch/pytestplugin/py/initpkg.py Thu Feb 12 12:36:21 2009
@@ -160,15 +160,18 @@
sys.modules[modpath] = module
# ---------------------------------------------------
-# Virtual Module Object
+# API Module Object
# ---------------------------------------------------
-class Module(ModuleType):
+class ApiModule(ModuleType):
def __init__(self, pkg, name):
self.__pkg__ = pkg
self.__name__ = name
self.__map__ = {}
+ def __repr__(self):
+ return '<ApiModule %r>' % (self.__name__,)
+
def __getattr__(self, name):
if '*' in self.__map__:
extpy = self.__map__['*'][0], name
@@ -203,9 +206,6 @@
except (AttributeError, TypeError):
pass
- def __repr__(self):
- return '<Module %r>' % (self.__name__, )
-
def getdict(self):
# force all the content of the module to be loaded when __dict__ is read
dictdescr = ModuleType.__dict__['__dict__']
@@ -248,7 +248,7 @@
previous = current
current += '.' + name
if current not in seen:
- seen[current] = mod = Module(pkg, current)
+ seen[current] = mod = ApiModule(pkg, current)
setattr(seen[previous], name, mod)
setmodule(current, mod)
Modified: py/branch/pytestplugin/py/misc/testing/test_initpkg.py
==============================================================================
--- py/branch/pytestplugin/py/misc/testing/test_initpkg.py (original)
+++ py/branch/pytestplugin/py/misc/testing/test_initpkg.py Thu Feb 12 12:36:21 2009
@@ -12,20 +12,20 @@
assert getattr(obj, '__map__') == {}
def test_dir():
- from py.__.initpkg import Module
+ from py.__.initpkg import ApiModule
for name in dir(py):
if name == 'magic': # greenlets don't work everywhere, we don't care here
continue
if not name.startswith('_'):
yield checksubpackage, name
-from py.initpkg import Module
+from py.initpkg import ApiModule
glob = []
-class MyModule(Module):
+class MyModule(ApiModule):
def __init__(self, *args):
glob.append(self.__dict__)
assert isinstance(glob[-1], (dict, type(None)))
- Module.__init__(self, *args)
+ ApiModule.__init__(self, *args)
def test_early__dict__access():
mymod = MyModule("whatever", "myname")
More information about the pytest-commit
mailing list