Skip to content

Commit 8263534

Browse files
merge again
1 parent 0e7e1f9 commit 8263534

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

CHANGELOG

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
1.2.dev
1+
1.3.dev
2+
----------------------------------------
3+
4+
- fix issue2 - adapt tests on Jython
5+
6+
1.2
27
----------------------------------------
38

49
- Allow to import from Aliasmodules (thanks Ralf Schmitt)

apipkg.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import sys
1010
from types import ModuleType
1111

12-
__version__ = '1.2.dev7'
12+
__version__ = '1.3.dev'
1313

1414
def initpkg(pkgname, exportdefs, attr=dict()):
1515
""" initialize given package from the export definitions. """

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def main():
1919
description=
2020
'apipkg: namespace control and lazy-import mechanism',
2121
long_description = open('README.txt').read(),
22-
version='1.2.dev7',
22+
version='1.3.dev',
2323
url='http://bitbucket.org/hpk42/apipkg',
2424
license='MIT License',
2525
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
@@ -38,4 +38,4 @@ def main():
3838
)
3939

4040
if __name__ == '__main__':
41-
main()
41+
main()

test_apipkg.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#
77
# test support for importing modules
88
#
9+
ModuleType = py.std.types.ModuleType
910

1011
class TestRealModule:
1112

@@ -202,15 +203,15 @@ def parsenamespace(spec):
202203
return ns
203204

204205
def test_initpkg_replaces_sysmodules(monkeypatch):
205-
mod = type(sys)('hello')
206+
mod = ModuleType('hello')
206207
monkeypatch.setitem(sys.modules, 'hello', mod)
207208
apipkg.initpkg('hello', {'x': 'os.path:abspath'})
208209
newmod = sys.modules['hello']
209210
assert newmod != mod
210211
assert newmod.x == py.std.os.path.abspath
211212

212213
def test_initpkg_transfers_attrs(monkeypatch):
213-
mod = type(sys)('hello')
214+
mod = ModuleType('hello')
214215
mod.__version__ = 10
215216
mod.__file__ = "hello.py"
216217
mod.__loader__ = "loader"
@@ -225,15 +226,15 @@ def test_initpkg_transfers_attrs(monkeypatch):
225226
assert newmod.__doc__ == mod.__doc__
226227

227228
def test_initpkg_nodoc(monkeypatch):
228-
mod = type(sys)('hello')
229+
mod = ModuleType('hello')
229230
mod.__file__ = "hello.py"
230231
monkeypatch.setitem(sys.modules, 'hello', mod)
231232
apipkg.initpkg('hello', {})
232233
newmod = sys.modules['hello']
233234
assert not newmod.__doc__
234235

235236
def test_initpkg_overwrite_doc(monkeypatch):
236-
hello = type(sys)('hello')
237+
hello = ModuleType('hello')
237238
hello.__doc__ = "this is the documentation"
238239
monkeypatch.setitem(sys.modules, 'hello', hello)
239240
apipkg.initpkg('hello', {"__doc__": "sys:__doc__"})
@@ -242,7 +243,7 @@ def test_initpkg_overwrite_doc(monkeypatch):
242243
assert newhello.__doc__ == sys.__doc__
243244

244245
def test_initpkg_not_transfers_not_existing_attrs(monkeypatch):
245-
mod = type(sys)('hello')
246+
mod = ModuleType('hello')
246247
mod.__file__ = "hello.py"
247248
monkeypatch.setitem(sys.modules, 'hello', mod)
248249
apipkg.initpkg('hello', {})
@@ -253,7 +254,7 @@ def test_initpkg_not_transfers_not_existing_attrs(monkeypatch):
253254
assert not hasattr(newmod, '__path__')
254255

255256
def test_initpkg_defaults(monkeypatch):
256-
mod = type(sys)('hello')
257+
mod = ModuleType('hello')
257258
monkeypatch.setitem(sys.modules, 'hello', mod)
258259
apipkg.initpkg('hello', {})
259260
newmod = sys.modules['hello']

tox.ini

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,7 @@ sdistsrc={distshare}/apipkg-*
66

77
[testenv]
88
commands=py.test --junitxml={envlogdir}/junit-{envname}.xml []
9-
deps= py
9+
deps=pytest
10+
11+
[testenv:jython]
12+
commands=py.test-jython --junitxml={envlogdir}/junit-{envname}.xml []

0 commit comments

Comments
 (0)