Skip to content

Add additional Plex test to IGNORE_UNCAUGHT_EXCEPTIONS list#33397

Closed
dmulcahey wants to merge 1 commit intohome-assistant:devfrom
dmulcahey:dm/add-plex-guard
Closed

Add additional Plex test to IGNORE_UNCAUGHT_EXCEPTIONS list#33397
dmulcahey wants to merge 1 commit intohome-assistant:devfrom
dmulcahey:dm/add-plex-guard

Conversation

@dmulcahey
Copy link
Copy Markdown
Contributor

@dmulcahey dmulcahey commented Mar 29, 2020

Proposed change

This PR adds an additional Plex test to the ignore uncaught exceptions list to fix dev builds. Currently builds: #33391, #33393, #33395 are failing with this:

request = <SubRequest 'hass' for <Function test_setup_when_certificate_changed[pyloop]>>

    @pytest.fixture
    def hass(loop, hass_storage, request):
        """Fixture to provide a test instance of Home Assistant."""
    
        def exc_handle(loop, context):
            """Handle exceptions by rethrowing them, which will fail the test."""
            exceptions.append(context["exception"])
            orig_exception_handler(loop, context)
    
        exceptions = []
        hass = loop.run_until_complete(async_test_home_assistant(loop))
        orig_exception_handler = loop.get_exception_handler()
        loop.set_exception_handler(exc_handle)
    
        yield hass
    
        loop.run_until_complete(hass.async_stop(force=True))
        for ex in exceptions:
            if (
                request.module.__name__,
                request.function.__name__,
            ) in IGNORE_UNCAUGHT_EXCEPTIONS:
                continue
            if isinstance(ex, ServiceNotFound):
                continue
>           raise ex

tests/conftest.py:107: 


/usr/local/lib/python3.7/concurrent/futures/thread.py:57: in run
    result = self.fn(*self.args, **self.kwargs)
homeassistant/components/plex/__init__.py:199: in close_websocket_session
    websocket.close()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <plexwebsocket.PlexWebsocket object at 0x7f3a84466ba8>

    def close(self):
        """Close the listening websocket."""
        self._active = False
>       self._current_task.cancel()
E       AttributeError: 'NoneType' object has no attribute 'cancel'

venv/lib/python3.7/site-packages/plexwebsocket.py:156: AttributeError

It looks like a guard is needed around self._current_task.cancel() in close on PlexWebsocket but that is in a lib and would require a lib update.

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

# Example configuration.yaml

Additional information

  • This PR fixes or closes issue: fixes #
  • This PR is related to issue:
  • Link to documentation pull request:

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@jjlawren
Copy link
Copy Markdown
Contributor

This shouldn't be necessary if #33398 is merged.

@dmulcahey
Copy link
Copy Markdown
Contributor Author

Closing in favor of #33398

@dmulcahey dmulcahey closed this Mar 29, 2020
@dmulcahey dmulcahey deleted the dm/add-plex-guard branch March 29, 2020 17:40
@lock lock Bot locked and limited conversation to collaborators Apr 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed core small-pr PRs with less than 30 lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants