Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Jul 27, 2021
1 parent ea9e11c commit ec0f57b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
17 changes: 5 additions & 12 deletions superset/reports/commands/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ def __init__(
self._execution_id = execution_id

def set_state_and_log(
self,
state: ReportState,
error_message: Optional[str] = None,
self, state: ReportState, error_message: Optional[str] = None,
) -> None:
"""
Updates current ReportSchedule state and TS. If on final state writes the log
Expand All @@ -104,8 +102,7 @@ def set_state_and_log(
now_dttm = datetime.utcnow()
self.set_state(state, now_dttm)
self.create_log(
state,
error_message=error_message,
state, error_message=error_message,
)

def set_state(self, state: ReportState, dttm: datetime) -> None:
Expand All @@ -119,9 +116,7 @@ def set_state(self, state: ReportState, dttm: datetime) -> None:
self._session.commit()

def create_log( # pylint: disable=too-many-arguments
self,
state: ReportState,
error_message: Optional[str] = None,
self, state: ReportState, error_message: Optional[str] = None,
) -> None:
"""
Creates a Report execution log, uses the current computed last_value for Alerts
Expand Down Expand Up @@ -477,14 +472,12 @@ def next(self) -> None:
if self.is_on_working_timeout():
exception_timeout = ReportScheduleWorkingTimeoutError()
self.set_state_and_log(
ReportState.ERROR,
error_message=str(exception_timeout),
ReportState.ERROR, error_message=str(exception_timeout),
)
raise exception_timeout
exception_working = ReportSchedulePreviousWorkingError()
self.set_state_and_log(
ReportState.WORKING,
error_message=str(exception_working),
ReportState.WORKING, error_message=str(exception_working),
)
raise exception_working

Expand Down
1 change: 1 addition & 0 deletions tests/integration_tests/reports/api_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ def test_get_report_schedule(self):
"chart": {
"id": report_schedule.chart.id,
"slice_name": report_schedule.chart.slice_name,
"viz_type": report_schedule.chart.viz_type,
},
"context_markdown": report_schedule.context_markdown,
"crontab": report_schedule.crontab,
Expand Down

0 comments on commit ec0f57b

Please sign in to comment.