summaryrefslogtreecommitdiff
path: root/lib/testscenarios/tests/test_scenarios.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/testscenarios/tests/test_scenarios.py')
-rw-r--r--lib/testscenarios/tests/test_scenarios.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/testscenarios/tests/test_scenarios.py b/lib/testscenarios/tests/test_scenarios.py
index 63a5992..087d987 100644
--- a/lib/testscenarios/tests/test_scenarios.py
+++ b/lib/testscenarios/tests/test_scenarios.py
@@ -117,6 +117,17 @@ class TestApplyScenario(testtools.TestCase):
class ReferenceTest(unittest.TestCase):
def test_pass(self):
pass
+ def test_pass_with_docstring(self):
+ """ The test that always passes.
+
+ This test case has a PEP 257 conformant docstring,
+ with its first line being a brief synopsis and the
+ rest of the docstring explaining that this test
+ does nothing but pass unconditionally.
+
+ """
+ pass
+
self.ReferenceTest = ReferenceTest
def test_sets_specified_id(self):
@@ -132,6 +143,15 @@ class TestApplyScenario(testtools.TestCase):
modified_test = apply_scenario(self.scenario, raw_test)
self.assertEqual('bar', modified_test.foo)
+ def test_appends_scenario_name_to_short_description(self):
+ raw_test = self.ReferenceTest('test_pass_with_docstring')
+ modified_test = apply_scenario(self.scenario, raw_test)
+ raw_doc = self.ReferenceTest.test_pass_with_docstring.__doc__
+ raw_desc = raw_doc.split("\n")[0].strip()
+ scenario_name = self.scenario_name
+ expect_desc = "%(raw_desc)s (%(scenario_name)s)" % vars()
+ self.assertEqual(expect_desc, modified_test.shortDescription())
+
class TestApplyScenarios(testtools.TestCase):
def test_calls_apply_scenario(self):