From 3a8a30a9ba2997b6b3c8258fadae08184ea1eacc Mon Sep 17 00:00:00 2001 From: Ying Ni Date: Tue, 12 May 2015 11:05:54 -0400 Subject: [PATCH] Modified setup.py and README.md. --- README.md | 8 ++++---- setup.py | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5a4d0c1..4b18124 100644 --- a/README.md +++ b/README.md @@ -303,7 +303,7 @@ def test_data_driven(self, **param): print('userid: %d, passwd: %s' % (param['userid'], param['passwd'])) ``` -Results: same results as using unishark.data_driven, but running with different inputs in separate threads, up to 2 threads are spawned. +Results: same results as using unishark.data_driven, but up to 2 threads are spawned, each running the test with a set of inputs (userid, passwd). Multi-threads data-driven in 'args style': ```python @@ -312,12 +312,12 @@ def test_data_driven(self, **param): sleep(param['time']) ``` -Results: it spawns up to 5 threads to run the test with 10 inputs concurrently (only sleep 1 sec in each thread). +Results: 5 threads are spawned to run the test with 10 sets of inputs concurrently (only sleep 1 sec in each thread). It takes about 2 sec in total (10 sec if using unishark.data_driven) to run. **NOTE**: It is user's responsibility to ensure thread-safe within the test method which is decorated by unishark.multi_threading_data_driven. -If exceptions are thrown in one or more threads, the exceptions information will be collected and summarized in the "main" thread in the end and thrown as unishark.exception.MultipleErrors. - +If exceptions are thrown in one or more threads, the exceptions information will be collected and summarized in the "main" thread and thrown as unishark.exception.MultipleErrors. + ## Advanced Usage diff --git a/setup.py b/setup.py index 3a5cf08..f2d5473 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,6 @@ from setuptools import setup, find_packages from os import path +from sys import version_info NAME = 'unishark' VERSION = '0.2.1' @@ -9,6 +10,15 @@ open(path.join('docs', 'CHANGELOG.rst'), 'r').read() ) +py3_requires = ['Jinja2>=2.7.2', 'MarkupSafe>=0.23'] +py2_requires = ['Jinja2>=2.7.2', 'MarkupSafe>=0.23', 'futures>=2.2.0'] + +requires = None +if version_info[0] >= 3 and version_info[1] >= 2: + requires = py3_requires +else: + requires = py2_requires + setup( name=NAME, version=VERSION, @@ -44,7 +54,7 @@ keywords='unittest extension test reports config utility', # See https://packaging.python.org/en/latest/requirements.html - install_requires=['Jinja2>=2.7.2', 'MarkupSafe>=0.23', 'futures>=2.2.0'], + install_requires=requires, extras_require={ 'test': ['coveralls'],