[py-svn] commit/apipkg: hpk42: fix issue2 - test use correct ModuleType on Jython
Bitbucket
commits-noreply at bitbucket.org
Sat Jun 9 23:01:53 CEST 2012
1 new commit in apipkg:
https://bitbucket.org/hpk42/apipkg/changeset/7306d9657bd0/
changeset: 7306d9657bd0
user: hpk42
date: 2012-06-09 23:00:15
summary: fix issue2 - test use correct ModuleType on Jython
affected #: 5 files
diff -r f39ea665e1da34aad8f0d459d5b0a3352e019e59 -r 7306d9657bd099fbbc01369e7039837ace479bf0 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,8 @@
+1.3.dev
+----------------------------------------
+
+- fix issue2 - adapt tests on Jython
+
1.2
----------------------------------------
diff -r f39ea665e1da34aad8f0d459d5b0a3352e019e59 -r 7306d9657bd099fbbc01369e7039837ace479bf0 apipkg.py
--- a/apipkg.py
+++ b/apipkg.py
@@ -9,7 +9,7 @@
import sys
from types import ModuleType
-__version__ = '1.2'
+__version__ = '1.3.dev'
def initpkg(pkgname, exportdefs, attr=dict()):
""" initialize given package from the export definitions. """
diff -r f39ea665e1da34aad8f0d459d5b0a3352e019e59 -r 7306d9657bd099fbbc01369e7039837ace479bf0 setup.py
--- a/setup.py
+++ b/setup.py
@@ -19,7 +19,7 @@
description=
'apipkg: namespace control and lazy-import mechanism',
long_description = open('README.txt').read(),
- version='1.2',
+ version='1.3.dev',
url='http://bitbucket.org/hpk42/apipkg',
license='MIT License',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
diff -r f39ea665e1da34aad8f0d459d5b0a3352e019e59 -r 7306d9657bd099fbbc01369e7039837ace479bf0 test_apipkg.py
--- a/test_apipkg.py
+++ b/test_apipkg.py
@@ -6,6 +6,7 @@
#
# test support for importing modules
#
+ModuleType = py.std.types.ModuleType
class TestRealModule:
@@ -202,7 +203,7 @@
return ns
def test_initpkg_replaces_sysmodules(monkeypatch):
- mod = type(sys)('hello')
+ mod = ModuleType('hello')
monkeypatch.setitem(sys.modules, 'hello', mod)
apipkg.initpkg('hello', {'x': 'os.path:abspath'})
newmod = sys.modules['hello']
@@ -210,7 +211,7 @@
assert newmod.x == py.std.os.path.abspath
def test_initpkg_transfers_attrs(monkeypatch):
- mod = type(sys)('hello')
+ mod = ModuleType('hello')
mod.__version__ = 10
mod.__file__ = "hello.py"
mod.__loader__ = "loader"
@@ -225,7 +226,7 @@
assert newmod.__doc__ == mod.__doc__
def test_initpkg_nodoc(monkeypatch):
- mod = type(sys)('hello')
+ mod = ModuleType('hello')
mod.__file__ = "hello.py"
monkeypatch.setitem(sys.modules, 'hello', mod)
apipkg.initpkg('hello', {})
@@ -233,7 +234,7 @@
assert not newmod.__doc__
def test_initpkg_overwrite_doc(monkeypatch):
- hello = type(sys)('hello')
+ hello = ModuleType('hello')
hello.__doc__ = "this is the documentation"
monkeypatch.setitem(sys.modules, 'hello', hello)
apipkg.initpkg('hello', {"__doc__": "sys:__doc__"})
@@ -242,7 +243,7 @@
assert newhello.__doc__ == sys.__doc__
def test_initpkg_not_transfers_not_existing_attrs(monkeypatch):
- mod = type(sys)('hello')
+ mod = ModuleType('hello')
mod.__file__ = "hello.py"
monkeypatch.setitem(sys.modules, 'hello', mod)
apipkg.initpkg('hello', {})
@@ -253,7 +254,7 @@
assert not hasattr(newmod, '__path__')
def test_initpkg_defaults(monkeypatch):
- mod = type(sys)('hello')
+ mod = ModuleType('hello')
monkeypatch.setitem(sys.modules, 'hello', mod)
apipkg.initpkg('hello', {})
newmod = sys.modules['hello']
diff -r f39ea665e1da34aad8f0d459d5b0a3352e019e59 -r 7306d9657bd099fbbc01369e7039837ace479bf0 tox.ini
--- a/tox.ini
+++ b/tox.ini
@@ -6,4 +6,7 @@
[testenv]
commands=py.test --junitxml={envlogdir}/junit-{envname}.xml []
-deps= pytest
+deps=pytest
+
+[testenv:jython]
+commands=py.test-jython --junitxml={envlogdir}/junit-{envname}.xml []
Repository URL: https://bitbucket.org/hpk42/apipkg/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list