summaryrefslogtreecommitdiff
path: root/unitTests.py
diff options
context:
space:
mode:
authorPaul McGuire <paulmcg@infinite.io>2019-11-05 08:50:43 -0600
committerPaul McGuire <paulmcg@infinite.io>2019-11-05 08:50:43 -0600
commitd78e9319916c9bc7853e4e16a96c8bae56272b45 (patch)
tree1bb2e78afff309ae87902689cfbe58965e2a2ede /unitTests.py
parent89be5c81b106f4fed9a7b815841bdcf85f870297 (diff)
downloadpyparsing-git-d78e9319916c9bc7853e4e16a96c8bae56272b45.tar.gz
Unresolved symbol reference in 2.4.3 release was masked by stdout buffering in unit tests
Diffstat (limited to 'unitTests.py')
-rw-r--r--unitTests.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/unitTests.py b/unitTests.py
index cfc4e90..da15ae3 100644
--- a/unitTests.py
+++ b/unitTests.py
@@ -85,6 +85,8 @@ BUFFER_OUTPUT = True
class ParseTestCase(TestCase):
def __init__(self):
super(ParseTestCase, self).__init__(methodName='_runTest')
+ self.expect_traceback = False
+ self.expect_warning = False
def _runTest(self):
@@ -103,6 +105,12 @@ class ParseTestCase(TestCase):
print_("<<<< End of test",str(self))
print_()
+ output = buffered_stdout.getvalue()
+ if "Traceback" in output and not self.expect_traceback:
+ raise Exception("traceback in stdout")
+ if "Warning" in output and not self.expect_warning:
+ raise Exception("warning in stdout")
+
except Exception as exc:
if BUFFER_OUTPUT:
print_()
@@ -1247,6 +1255,8 @@ class EllipsisRepetionTest(ParseTestCase):
class CustomQuotesTest(ParseTestCase):
def runTest(self):
+ self.expect_warning = True
+
from pyparsing import QuotedString
testString = r"""
@@ -1861,6 +1871,7 @@ class UpcaseDowncaseUnicode(ParseTestCase):
class ParseUsingRegex(ParseTestCase):
def runTest(self):
+ self.expect_warning = True
import re
@@ -1963,6 +1974,7 @@ class RegexAsTypeTest(ParseTestCase):
class RegexSubTest(ParseTestCase):
def runTest(self):
+ self.expect_warning = True
import pyparsing as pp
print_("test sub with string")
@@ -3963,6 +3975,8 @@ class LiteralExceptionTest(ParseTestCase):
class ParseActionExceptionTest(ParseTestCase):
def runTest(self):
+ self.expect_traceback = True
+
import pyparsing as pp
import traceback
@@ -4614,6 +4628,8 @@ class WarnUngroupedNamedTokensTest(ParseTestCase):
" ungrouped named expressions"):
path = coord[...].setResultsName('path')
+ pp.__diag__.warn_ungrouped_named_tokens_in_collection = False
+
class WarnNameSetOnEmptyForwardTest(ParseTestCase):
"""
@@ -4715,6 +4731,7 @@ class UndesirableButCommonPracticesTest(ParseTestCase):
class MiscellaneousParserTests(ParseTestCase):
def runTest(self):
+ self.expect_warning = True
runtests = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
if IRON_PYTHON_ENV: