summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2015-05-04 12:12:16 +1200
committerRobert Collins <robertc@robertcollins.net>2015-05-04 12:12:16 +1200
commitbccfaa71a2def5590161b6d1a247cf23c45a8b4d (patch)
tree4205080a391dc00332f018d781026b2381ddb2c6
parent475857af19a8190c9c0c7f8241b9907b942e19fd (diff)
downloadtestscenarios-git-bccfaa71a2def5590161b6d1a247cf23c45a8b4d.tar.gz
0.4
~~~ IMPROVEMENTS ------------ * Python 3.2 support added. (Robert Collins)
-rw-r--r--NEWS25
-rw-r--r--README9
-rw-r--r--lib/testscenarios/__init__.py2
-rw-r--r--lib/testscenarios/scenarios.py5
-rw-r--r--setup.cfg0
-rwxr-xr-xsetup.py10
6 files changed, 31 insertions, 20 deletions
diff --git a/NEWS b/NEWS
index 0d1663a..fc3a10c 100644
--- a/NEWS
+++ b/NEWS
@@ -6,10 +6,19 @@ testscenarios release notes
IN DEVELOPMENT
~~~~~~~~~~~~~~
+0.4
+~~~
+
+IMPROVEMENTS
+------------
+
+* Python 3.2 support added. (Robert Collins)
+
0.3
~~~
-CHANGES:
+CHANGES
+-------
* New function ``per_module_scenarios`` for tests that should be applied across
multiple modules providing the same interface, some of which may not be
@@ -22,7 +31,8 @@ CHANGES:
0.2
~~~
-CHANGES:
+CHANGES
+-------
* Adjust the cloned tests ``shortDescription`` if one is present. (Ben Finney)
@@ -32,7 +42,8 @@ CHANGES:
0.1
~~~
-CHANGES:
+CHANGES
+-------
* Created project. The primary interfaces are
``testscenarios.TestWithScenarios`` and
@@ -43,11 +54,3 @@ CHANGES:
Also various presentation and language touchups. (Martin Pool)
(Adjusted to use doctest directly, and to not print the demo runners
output to stderror during make check - Robert Collins)
-
-IMPROVEMENTS:
-
-BUG FIXES:
-
-API CHANGES:
-
-INTERNALS:
diff --git a/README b/README
index 002c340..e7e7eb7 100644
--- a/README
+++ b/README
@@ -98,7 +98,10 @@ you can cause scenario application to happen later by calling
``testscenarios.generate_scenarios()``. For instance::
>>> import unittest
- >>> import StringIO
+ >>> try:
+ ... from StringIO import StringIO
+ ... except ImportError:
+ ... from io import StringIO
>>> from testscenarios.scenarios import generate_scenarios
This can work with loaders and runners from the standard library, or possibly other
@@ -106,7 +109,7 @@ implementations::
>>> loader = unittest.TestLoader()
>>> test_suite = unittest.TestSuite()
- >>> runner = unittest.TextTestRunner(stream=StringIO.StringIO())
+ >>> runner = unittest.TextTestRunner(stream=StringIO())
>>> mytests = loader.loadTestsFromNames(['doc.test_sample'])
>>> test_suite.addTests(generate_scenarios(mytests))
@@ -211,7 +214,7 @@ cross product of tests. ::
...
>>> suite2 = unittest.TestSuite()
>>> suite2.addTests(generate_scenarios(suite))
- >>> print suite2.countTestCases()
+ >>> print(suite2.countTestCases())
4
Dynamic Scenarios
diff --git a/lib/testscenarios/__init__.py b/lib/testscenarios/__init__.py
index 356dc41..ceacf37 100644
--- a/lib/testscenarios/__init__.py
+++ b/lib/testscenarios/__init__.py
@@ -38,7 +38,7 @@ methods for details.
# established at this point, and setup.py will use a version of next-$(revno).
# If the releaselevel is 'final', then the tarball will be major.minor.micro.
# Otherwise it is major.minor.micro~$(revno).
-__version__ = (0, 3, 0, 'final', 0)
+__version__ = (0, 4, 0, 'final', 0)
__all__ = [
'TestWithScenarios',
diff --git a/lib/testscenarios/scenarios.py b/lib/testscenarios/scenarios.py
index 9538b33..eeb72eb 100644
--- a/lib/testscenarios/scenarios.py
+++ b/lib/testscenarios/scenarios.py
@@ -34,7 +34,7 @@ from testtools.testcase import clone_test_with_new_id
from testtools import iterate_tests
-def apply_scenario((name, parameters), test):
+def apply_scenario(scenario, test):
"""Apply scenario to test.
:param scenario: A tuple (name, parameters) to apply to the test. The test
@@ -43,6 +43,7 @@ def apply_scenario((name, parameters), test):
:param test: The test to apply the scenario to. This test is unaltered.
:return: A new test cloned from test, with the scenario applied.
"""
+ name, parameters = scenario
scenario_suffix = '(' + name + ')'
newtest = clone_test_with_new_id(test,
test.id() + scenario_suffix)
@@ -50,7 +51,7 @@ def apply_scenario((name, parameters), test):
if test_desc is not None:
newtest_desc = "%(test_desc)s %(scenario_suffix)s" % vars()
newtest.shortDescription = (lambda: newtest_desc)
- for key, value in parameters.iteritems():
+ for key, value in parameters.items():
setattr(newtest, key, value)
return newtest
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/setup.cfg
diff --git a/setup.py b/setup.py
index 6116557..6b0d596 100755
--- a/setup.py
+++ b/setup.py
@@ -1,12 +1,12 @@
#!/usr/bin/env python
-from distutils.core import setup
+from setuptools import setup
import os.path
-description = file(os.path.join(os.path.dirname(__file__), 'README'), 'rb').read()
+description = open(os.path.join(os.path.dirname(__file__), 'README'), 'rt').read()
setup(name="testscenarios",
- version="0.3",
+ version="0.4",
description="Testscenarios, a pyunit extension for dependency injection",
long_description=description,
maintainer="Robert Collins",
@@ -21,7 +21,11 @@ setup(name="testscenarios",
'License :: OSI Approved :: Apache Software License',
'Operating System :: OS Independent',
'Programming Language :: Python',
+ 'Programming Language :: Python :: 3',
'Topic :: Software Development :: Quality Assurance',
'Topic :: Software Development :: Testing',
],
+ install_requires = [
+ 'testtools',
+ ]
)