Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removes I/O from linky tests #31299

merged 1 commit into from Jan 30, 2020

Removes I/O from linky tests #31299

merged 1 commit into from Jan 30, 2020


Copy link

balloob commented Jan 30, 2020

Breaking change

Proposed change

PyLinky, used by the linky integration, uses a Fake User Agent package. That package actually makes requests to the web for latest user agent strings. This website sometimes rejects requests, and then the package is even sleeping 馃檮

This mocks it out during testing so we no longer hammer that website during our test suite. Also speeds up tests from 9s to 0.30s and fixes a flaky test.

Example stacktrace:

DEBUG:fake_useragent:Error occurred during fetching
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/urllib/", line 1317, in do_open
  File "/usr/local/lib/python3.7/http/", line 1229, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "/usr/local/lib/python3.7/http/", line 1275, in _send_request
    self.endheaders(body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/", line 1224, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "/usr/local/lib/python3.7/http/", line 1016, in _send_output
  File "/usr/local/lib/python3.7/http/", line 956, in send
  File "/usr/local/lib/python3.7/http/", line 928, in connect
    (,self.port), self.timeout, self.source_address)
  File "/usr/local/lib/python3.7/", line 727, in create_connection
    raise err
  File "/usr/local/lib/python3.7/", line 716, in create_connection
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/__w/1/s/venv/lib/python3.7/site-packages/fake_useragent/", line 67, in get
  File "/usr/local/lib/python3.7/urllib/", line 222, in urlopen
    return, data, timeout)
  File "/usr/local/lib/python3.7/urllib/", line 525, in open
    response = self._open(req, data)
  File "/usr/local/lib/python3.7/urllib/", line 543, in _open
    '_open', req)
  File "/usr/local/lib/python3.7/urllib/", line 503, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.7/urllib/", line 1345, in http_open
    return self.do_open(http.client.HTTPConnection, req)
  File "/usr/local/lib/python3.7/urllib/", line 1319, in do_open
    raise URLError(err)
urllib.error.URLError: <urlopen error timed out>
DEBUG:fake_useragent:Sleeping for 0.1 seconds

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:


  • 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

This comment has been minimized.

Copy link

probot-home-assistant bot commented Jan 30, 2020

Hey there @Quentame, mind taking a look at this pull request as its been labeled with a integration (linky) you are listed as a codeowner for? Thanks!

@balloob balloob merged commit da14e29 into dev Jan 30, 2020
11 checks passed
11 checks passed
CI Build #20200130.21 succeeded
CI (FullCheck Mypy) FullCheck Mypy succeeded
CI (FullCheck Pylint) FullCheck Pylint succeeded
CI (Overview CheckFormat) Overview CheckFormat succeeded
CI (Overview Lint) Overview Lint succeeded
CI (Overview Validate) Overview Validate succeeded
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
cla-bot Everyone involved has signed the CLA
codecov/patch Coverage not affected.
codecov/project 94.61% (target 90%)
docs-missing Documentation ok.
Dev automation moved this from Needs review to Done Jan 30, 2020
@delete-merged-branch delete-merged-branch bot deleted the remove-io-linky-tests branch Jan 30, 2020
@lock lock bot locked and limited conversation to collaborators Jan 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can鈥檛 perform that action at this time.