Skip to content

Commit

Permalink
Use run_test_with_logging in robot test
Browse files Browse the repository at this point in the history
  • Loading branch information
JokeWaumans committed Dec 6, 2024
1 parent cca6fc5 commit 93864a7
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions tests/test_robot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import unittest

from mlx.warnings import RobotSuiteChecker, WarningsPlugin
from test_integration import run_test_with_logging


class TestRobotWarnings(unittest.TestCase):
Expand Down Expand Up @@ -30,18 +31,15 @@ def test_single_warning(self):
self.assertIn("INFO:root:Suite One & Suite Two.Suite One.First Test", stdout_log)

def test_double_warning_and_verbosity(self):
with open('tests/test_in/robot_double_fail.xml') as xmlfile:
with self.assertLogs(level="INFO") as fake_out:
self.warnings.check(xmlfile.read())
count = self.warnings.return_count()
stdout_log = fake_out.output

self.assertEqual(count, 2)
stdout_log, retval = run_test_with_logging(['--verbose',
'--robot',
'tests/test_in/robot_double_fail.xml'])
self.assertEqual(retval, 2)
self.assertEqual(
[
"INFO:root:Suite One & Suite Two.Suite One.First Test",
"INFO:root:Suite One & Suite Two.Suite Two.Another test",
],
"Suite One & Suite Two.Suite One.First Test\n"
"Suite One & Suite Two.Suite Two.Another test\n"
"robot: all test suites number of warnings (2) is higher than the maximum limit (0).\n"
"Returning error code 2.\n",
stdout_log
)

Expand Down

0 comments on commit 93864a7

Please sign in to comment.