From 34b2583ee5509daf8b237a9c55173026ad42b2bc Mon Sep 17 00:00:00 2001 From: Cédric Ollivier Date: Tue, 23 May 2017 19:07:52 +0200 Subject: Protect against self.suite = None MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie3370ebfdd51b9aff707e50b754ca52796e49fbf Signed-off-by: Cédric Ollivier --- functest/tests/unit/core/test_unit.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'functest/tests/unit/core') diff --git a/functest/tests/unit/core/test_unit.py b/functest/tests/unit/core/test_unit.py index f86ea8d3..79c4e7d7 100644 --- a/functest/tests/unit/core/test_unit.py +++ b/functest/tests/unit/core/test_unit.py @@ -20,6 +20,7 @@ class PyTestSuiteRunnerTesting(unittest.TestCase): def setUp(self): self.psrunner = unit.Suite() + self.psrunner.suite = "foo" @mock.patch('unittest.TestLoader') def _test_run(self, mock_class=None, result=mock.Mock(), @@ -30,7 +31,10 @@ class PyTestSuiteRunnerTesting(unittest.TestCase): mock_class.assert_not_called() def test_check_suite_null(self): - self.assertEqual(self.psrunner.suite, None) + self.assertEqual(unit.Suite().suite, None) + self.psrunner.suite = None + self._test_run(result=mock.Mock(), + status=testcase.TestCase.EX_RUN_ERROR) def test_run_no_ut(self): mock_result = mock.Mock(testsRun=0, errors=[], failures=[]) -- cgit 1.2.3-korg