[py-svn] apipkg commit c76615baa4a2: also transfer __loader__ attribute (thanks ralf schmitt), bump version
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Sun Jan 10 13:44:14 CET 2010
# HG changeset patch -- Bitbucket.org
# Project apipkg
# URL http://bitbucket.org/hpk42/apipkg/overview/
# User holger krekel <holger at merlinux.eu>
# Date 1262525013 -3600
# Node ID c76615baa4a26f89adb1c52b26f401b35001006d
# Parent 5fc11da5b2f62f4bd225672b3f01b4ff3747afb3
also transfer __loader__ attribute (thanks ralf schmitt), bump version
--- a/test_apipkg.py
+++ b/test_apipkg.py
@@ -165,16 +165,18 @@ def test_initpkg_replaces_sysmodules(mon
assert newmod != mod
assert newmod.x == py.std.os.path.abspath
-def test_initpkg_transfers_version_and_file(monkeypatch):
+def test_initpkg_transfers_attrs(monkeypatch):
mod = type(sys)('hello')
mod.__version__ = 10
mod.__file__ = "hello.py"
+ mod.__loader__ = "loader"
monkeypatch.setitem(sys.modules, 'hello', mod)
apipkg.initpkg('hello', {})
newmod = sys.modules['hello']
assert newmod != mod
assert newmod.__file__ == mod.__file__
assert newmod.__version__ == mod.__version__
+ assert newmod.__loader__ == mod.__loader__
def test_initpkg_defaults(monkeypatch):
mod = type(sys)('hello')
--- a/apipkg.py
+++ b/apipkg.py
@@ -8,7 +8,7 @@ see http://pypi.python.org/pypi/apipkg
import sys
from types import ModuleType
-__version__ = "1.0b3"
+__version__ = "1.0b4"
def initpkg(pkgname, exportdefs):
""" initialize given package from the export definitions. """
@@ -17,6 +17,7 @@ def initpkg(pkgname, exportdefs):
mod.__file__ = getattr(oldmod, '__file__', None)
mod.__version__ = getattr(oldmod, '__version__', None)
mod.__path__ = getattr(oldmod, '__path__', None)
+ mod.__loader__ = getattr(oldmod, '__loader__', None)
sys.modules[pkgname] = mod
def importobj(modpath, attrname):
--- a/readme.txt
+++ b/readme.txt
@@ -5,9 +5,11 @@ With apipkg you can control the exported
python package and greatly reduce the number of imports for your users.
It is a `small pure python module`_ that works on virtually all Python
versions, including CPython2.3 to Python3.1, Jython and PyPy. It co-operates
-well with Python's ``help()`` system and common command line completion
-tools. Usage is very simple: you can require 'apipkg' as a dependency
-or you can copy paste the <100 Lines of code into your project.
+well with Python's ``help()`` system, custom importers (PEP302) and common
+command line completion tools.
+
+Usage is very simple: you can require 'apipkg' as a dependency or you
+can copy paste the <100 Lines of code into your project.
Tutorial example
-------------------
More information about the pytest-commit
mailing list