From 0237fa90dd0140d84c775e4195e8f29b7fe1487f Mon Sep 17 00:00:00 2001 From: John Sirois Date: Thu, 21 Feb 2019 18:59:46 -0800 Subject: [PATCH] Desensitize some tests to stderr output. --- .../pants_test/base/test_exception_sink_integration.py | 2 +- .../pants_test/engine/legacy/test_graph_integration.py | 2 +- tests/python/pants_test/rules/test_test_integration.py | 8 -------- 3 files changed, 2 insertions(+), 10 deletions(-) diff --git a/tests/python/pants_test/base/test_exception_sink_integration.py b/tests/python/pants_test/base/test_exception_sink_integration.py index 9ea4e38f673f..f12bd5eff31e 100644 --- a/tests/python/pants_test/base/test_exception_sink_integration.py +++ b/tests/python/pants_test/base/test_exception_sink_integration.py @@ -52,7 +52,7 @@ def test_logs_unhandled_exception(self): # The backtrace should be omitted when --print-exception-stacktrace=False. print_exception_stacktrace=False) self.assert_failure(pants_run) - assertRegex(self, pants_run.stderr_data, """\\A\ + assertRegex(self, pants_run.stderr_data, """\ timestamp: ([^\n]+) Exception caught: \\(pants\\.build_graph\\.address_lookup_error\\.AddressLookupError\\) \\(backtrace omitted\\) Exception message: Build graph construction failed: ExecutionError 1 Exception encountered: diff --git a/tests/python/pants_test/engine/legacy/test_graph_integration.py b/tests/python/pants_test/engine/legacy/test_graph_integration.py index f517d3953c0c..b3111e4e1340 100644 --- a/tests/python/pants_test/engine/legacy/test_graph_integration.py +++ b/tests/python/pants_test/engine/legacy/test_graph_integration.py @@ -56,7 +56,7 @@ def _list_target_check_warnings_sources(self, target_name): ". Unmatched globs were: " + "[{}]".format(', '.join('"{}"'.format(os.path.join(self._SOURCES_TARGET_BASE, g)) for g in expected_globs)) + ".\n\n") - self.assertEqual(warning_msg, pants_run.stderr_data) + self.assertIn(warning_msg, pants_run.stderr_data) _ERR_TARGETS = { 'testprojects/src/python/sources:some-missing-some-not': [ diff --git a/tests/python/pants_test/rules/test_test_integration.py b/tests/python/pants_test/rules/test_test_integration.py index 60127dadf22f..e6761300cdfc 100644 --- a/tests/python/pants_test/rules/test_test_integration.py +++ b/tests/python/pants_test/rules/test_test_integration.py @@ -40,11 +40,7 @@ def run_passing_pants_test(self, trailing_args): ] + trailing_args pants_run = self.run_pants(args) - self.assert_success(pants_run) - self.assertEqual("", pants_run.stderr_data) - self.assertEqual(pants_run.returncode, 0) - return pants_run def run_failing_pants_test(self, trailing_args): @@ -55,11 +51,7 @@ def run_failing_pants_test(self, trailing_args): ] + trailing_args pants_run = self.run_pants(args) - self.assert_failure(pants_run) - self.assertEqual("", pants_run.stderr_data) - self.assertEqual(pants_run.returncode, 1) - return pants_run def test_passing_python_test(self):