Add python26 multiline string assertion back.
The assertMultiline equal was removed for assertEqual to be python26 friendly. Testtools has a matcher that provides similar functionality that is python26 compatible. Use testtools instead of unittest for this functionality. Remove use of unittest.main(). Change-Id: I348b0ee0192d3164084c20d9356e69f29e1cb86c
This commit is contained in:
parent
96211e74d6
commit
b8fbb7193d
@ -17,10 +17,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import doctest
|
||||
import os
|
||||
import re
|
||||
from testscenarios.testcase import TestWithScenarios
|
||||
import unittest
|
||||
import testtools
|
||||
import xml.etree.ElementTree as XML
|
||||
import yaml
|
||||
|
||||
@ -55,10 +56,10 @@ def get_scenarios():
|
||||
return scenarios
|
||||
|
||||
|
||||
class TestCaseModulePublisher(TestWithScenarios):
|
||||
class TestCaseModulePublisher(TestWithScenarios, testtools.TestCase):
|
||||
scenarios = get_scenarios()
|
||||
|
||||
# unittest.TestCase settings:
|
||||
# TestCase settings:
|
||||
maxDiff = None # always dump text difference
|
||||
longMessage = True # keep normal error message when providing our
|
||||
|
||||
@ -86,10 +87,10 @@ class TestCaseModulePublisher(TestWithScenarios):
|
||||
# Prettify generated XML
|
||||
pretty_xml = XmlJob(xml_project, 'fixturejob').output()
|
||||
|
||||
self.assertEqual(
|
||||
expected_xml, pretty_xml,
|
||||
'Test inputs: %s, %s' % (self.yaml_filename, self.xml_filename)
|
||||
self.assertThat(
|
||||
pretty_xml,
|
||||
testtools.matchers.DocTestMatches(expected_xml,
|
||||
doctest.ELLIPSIS |
|
||||
doctest.NORMALIZE_WHITESPACE |
|
||||
doctest.REPORT_NDIFF)
|
||||
)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
@ -4,4 +4,5 @@ python-subunit
|
||||
sphinx
|
||||
setuptools_git>=0.4
|
||||
testscenarios
|
||||
testtools
|
||||
testrepository
|
||||
|
Loading…
Reference in New Issue
Block a user