Skip to content

Conversation

@Poolitzer
Copy link
Member

Checklist for PRs

  • Added .. versionadded:: version, .. versionchanged:: version or .. deprecated:: version to the docstrings for user facing changes (for methods/class descriptions, arguments and attributes)
  • Created new or adapted existing unit tests
  • Documented code changes according to the CSI standard
  • Added myself alphabetically to AUTHORS.rst (optional)
  • Added new classes & modules to the docs and all suitable __all__ s

Copy link
Member

@harshil21 harshil21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice. hinrich reviewed pretty much everything, so only one comment from me-

@harshil21 harshil21 modified the milestones: v20.0a1, v20.0 May 25, 2022
@harshil21 harshil21 added enhancement 🔗 windows related technology: windows 🛠 refactor change type: refactor and removed enhancement labels May 25, 2022
Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates! Can you add tests for the missing coverage?

Comment on lines 1704 to 1716
if platform.system() == "Windows":

def signal_handler_test_windows(*args, **kwargs):
# this should be empty, but still called once.
assert args == []

monkeypatch.setattr(loop, "add_signal_handler", signal_handler_test_windows)
# this should run through, and we expect the signals to be empty
app.job_queue.run_once(abort_app, 2)
# pass false so it is not default
app.run_webhook(
port=49152, webhook_url="example.com", close_loop=False, stop_signals=False
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, but this still doesn't do it IMO. stop_signals=False doesn't make sense because we do in fact want to test the default case. Moreover, add_signal_handler is never called (as intended), so the assert in the mocked function doesn't test anything. Granted, it raises an AssertionError if a code change accidently passes a signal on windows (only without stop_signal=False though), but that's really hard to read from this test. Additionally, it feels unncessary to have the above tests do nothing on windows (which again is not obvious from the tests) and only this if-clause actually test something.

What speaks against implementing the test as suggested in https://github.com/python-telegram-bot/python-telegram-bot/pull/3065/files#r879864569 ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What speaks against implementing the test as suggested

me forgetting you suggested that.

Poolitzer and others added 2 commits May 30, 2022 21:12
In case we break, we also have timeout now I decided
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Looks like you edited the (dev) requirements or the pre-commit hooks. I'm just a friendly reminder to keep the pre-commit hook versions in sync with the dev requirements and the additional dependencies for the hooks in sync with the requirements :)

Copy link
Member

@Bibo-Joshi Bibo-Joshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :) You probably run the test on windows a few times to check if the pytesttimeout does the trick?

@Poolitzer
Copy link
Member Author

I did yup

@Bibo-Joshi Bibo-Joshi merged commit 306cc64 into master Jun 2, 2022
@Bibo-Joshi Bibo-Joshi deleted the improve_default_signal_handlers branch June 2, 2022 07:43
@github-actions github-actions bot locked and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

🛠 refactor change type: refactor 🔗 windows related technology: windows

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants