don't import stuff at genscript import time but rather when it is used

This commit is contained in:
holger krekel 2011-03-12 20:12:19 +01:00
parent a7131dc911
commit a9f1f26a39
4 changed files with 9 additions and 10 deletions

View File

@ -1,6 +1,9 @@
Changes between 2.0.2 and 2.0.3.dev
----------------------------------------------
- don't require zlib (and other libs) for genscript plugin without
--genscript actually being used.
- speed up skips (by not doing a full traceback represenation
internally)

View File

@ -1,8 +1,5 @@
""" generate a single-file self-contained version of py.test """
import py
import pickle
import zlib
import base64
def find_toplevel(name):
for syspath in py.std.sys.path:
@ -31,9 +28,9 @@ def pkg_to_mapping(name):
return name2src
def compress_mapping(mapping):
data = pickle.dumps(mapping, 2)
data = zlib.compress(data, 9)
data = base64.encodestring(data)
data = py.std.pickle.dumps(mapping, 2)
data = py.std.zlib.compress(data, 9)
data = py.std.base64.encodestring(data)
data = data.decode('ascii')
return data
@ -44,7 +41,6 @@ def compress_packages(names):
mapping.update(pkg_to_mapping(name))
return compress_mapping(mapping)
def generate_script(entry, packages):
data = compress_packages(packages)
tmpl = py.path.local(__file__).dirpath().join('standalonetemplate.py')

View File

@ -1,7 +1,7 @@
"""
unit and functional testing with Python.
"""
__version__ = '2.0.3.dev0'
__version__ = '2.0.3.dev1'
__all__ = ['main']
from _pytest.core import main, UsageError, _preloadplugins

View File

@ -22,7 +22,7 @@ def main():
name='pytest',
description='py.test: simple powerful testing with Python',
long_description = long_description,
version='2.0.3.dev0',
version='2.0.3.dev1',
url='http://pytest.org',
license='MIT license',
platforms=['unix', 'linux', 'osx', 'cygwin', 'win32'],
@ -67,4 +67,4 @@ def make_entry_points():
return {'console_scripts': l}
if __name__ == '__main__':
main()
main()