[
https://issues.apache.org/jira/browse/BEAM-12096?focusedWorklogId=577755&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-577755
]
ASF GitHub Bot logged work on BEAM-12096:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 06/Apr/21 17:12
Start Date: 06/Apr/21 17:12
Worklog Time Spent: 10m
Work Description: KevinGG commented on a change in pull request #14437:
URL: https://github.com/apache/beam/pull/14437#discussion_r608035343
##########
File path: sdks/python/apache_beam/runners/interactive/utils_test.py
##########
@@ -182,6 +183,9 @@ def
test_child_module_logger_can_override_logging_level(self, mock_emit):
@unittest.skipIf(
not ie.current_env().is_interactive_ready,
'[interactive] dependency is not installed.')
[email protected](
Review comment:
>In such cases, I would rather the test failed with a descriptive error
message. If dependencies are not installed >correctly, that indicates a real
problem with either our test setup or the actual code, and we should be aware
of it. >But I'm not sure what is the best way to differentiate between
intentional skips (as described above) and accidental >skips.
Make sense, let me change the logging to error level. In that case, if the
test is not skipped but later somehow the dependency is not installed (or
removed), it will error out and expose the problem.
>How do you know?
Based on the stacktrace in the reported JIRA ticket. The actual call is
```
actual = [call('\n <link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min...">You
have limited Interactive Beam features since your ipython kernel is not
connected any notebook frontend.</div>')]
```
This indicates `is_in_ipython and not is_in_notebook`, which contradicts
with the setup in the test. It means the global instance `ie.current_env()` is
modified during the test by other tests. By mocking the IPython environment and
the usage of the global instance, this test is isolated from potential race
situations.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 577755)
Time Spent: 2h 50m (was: 2h 40m)
> Flake: test_progress_in_HTML_JS_when_in_notebook
> ------------------------------------------------
>
> Key: BEAM-12096
> URL: https://issues.apache.org/jira/browse/BEAM-12096
> Project: Beam
> Issue Type: Bug
> Components: test-failures
> Reporter: Kyle Weaver
> Assignee: Ning Kang
> Priority: P1
> Labels: flake
> Time Spent: 2h 50m
> Remaining Estimate: 0h
>
> *
> https://ci-beam.apache.org/job/beam_PreCommit_Python_Commit/18008/testReport/junit/apache_beam.runners.interactive.utils_test/ProgressIndicatorTest/test_progress_in_HTML_JS_when_in_notebook/
> self = <apache_beam.runners.interactive.utils_test.ProgressIndicatorTest
> testMethod=test_progress_in_HTML_JS_when_in_notebook> def
> test_progress_in_HTML_JS_when_in_notebook(self):
> ie.current_env()._is_in_notebook = True pi_path =
> 'apache_beam.runners.interactive.utils.ProgressIndicator' with
> patch('IPython.core.display.HTML') as mocked_html, \
> patch('IPython.core.display.Javascript') as mocked_javascript, \
> patch(pi_path + '.spinner_template') as enter_template, \ patch(pi_path +
> '.spinner_removal_template') as exit_template:
> enter_template.format.return_value = 'enter'
> exit_template.format.return_value = 'exit' @utils.progress_indicated def
> progress_indicated_dummy(): mocked_html.assert_any_call('enter') >
> progress_indicated_dummy() apache_beam/runners/interactive/utils_test.py:217:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> _ apache_beam/runners/interactive/utils.py:235: in
> run_within_progress_indicator return func(*args, **kwargs)
> apache_beam/runners/interactive/utils_test.py:215: in
> progress_indicated_dummy mocked_html.assert_any_call('enter') _ _ _ _ _ _ _ _
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ self =
> <MagicMock name='HTML' id='140195651256392'>, args = ('enter',) kwargs = {},
> expected = (('enter',), {}) actual = [call('\n <link rel="stylesheet" href="
> [https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min..."|https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min...]
> >You have limited Interactive Beam features since your ipython kernel is not
> >connected any notebook frontend.</div>')] cause = None, expected_string =
> >"HTML('enter')" def assert_any_call(self, *args, **kwargs): """assert the
> >mock has been called with the specified arguments. The assert passes if the
> >mock has *ever* been called, unlike `assert_called_with` and
> >`assert_called_once_with` that only pass if the call is the most recent
> >one.""" expected = self._call_matcher((args, kwargs)) actual =
> >[self._call_matcher(c) for c in self.call_args_list] if expected not in
> >actual: cause = expected if isinstance(expected, Exception) else None
> >expected_string = self._format_mock_call_signature(args, kwargs) raise
> >AssertionError( '%s call not found' % expected_string > ) from cause E
> >AssertionError: HTML('enter') call not found
> >/usr/lib/python3.7/unittest/mock.py:891: AssertionError
--
This message was sent by Atlassian Jira
(v8.3.4#803005)