]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Run.report_outcome: Drop fake_ctx
authorZack Cerza <zack@redhat.com>
Thu, 11 Jul 2024 16:06:25 +0000 (10:06 -0600)
committerZack Cerza <zack@redhat.com>
Thu, 11 Jul 2024 22:48:31 +0000 (16:48 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/run.py
teuthology/test/test_run.py

index 8ac6b7b58cf9263c02ff86b04f55946088d0fc3f..e465b6a31d148291ee35d777764671f4527abb0e 100644 (file)
@@ -260,7 +260,7 @@ def get_initial_tasks(lock, config, machine_type):
     return init_tasks
 
 
-def report_outcome(config, archive, summary, fake_ctx):
+def report_outcome(config, archive, summary):
     """ Reports on the final outcome of the command. """
     status = get_status(summary)
     passed = status == 'pass'
@@ -406,4 +406,4 @@ def main(args):
         run_tasks(tasks=config['tasks'], ctx=fake_ctx)
     finally:
         # print to stdout the results and possibly send an email on any errors
-        report_outcome(config, archive, fake_ctx.summary, fake_ctx)
+        report_outcome(config, archive, fake_ctx.summary)
index c176c8f653b9ac6f57343d57ac6a81d6bc089a7b..c2bcff4abe57886e072144441fbc2bc35266883d 100644 (file)
@@ -1,7 +1,7 @@
 import pytest
 import docopt
 
-from unittest.mock import patch, call, Mock
+from unittest.mock import patch, call
 
 from teuthology import run
 from scripts import run as scripts_run
@@ -133,13 +133,12 @@ class TestRun(object):
     @patch("sys.exit")
     def test_report_outcome(self, m_sys_exit, m_open, m_email_results, m_try_push_job_info, m_safe_dump, m_get_status):
         m_get_status.return_value = "fail"
-        fake_ctx = Mock()
         summary = {"failure_reason": "reasons"}
         summary_dump = "failure_reason: reasons\n"
         config = {"email-on-error": True}
         config_dump = "email-on-error: true\n"
         m_safe_dump.side_effect = [None, summary_dump, config_dump]
-        run.report_outcome(config, "the/archive/path", summary, fake_ctx)
+        run.report_outcome(config, "the/archive/path", summary)
         m_try_push_job_info.assert_called_with(config, summary)
         m_open.assert_called_with("the/archive/path/summary.yaml", "w")
         assert m_email_results.called