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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix incorrect type cast in vterm (apply_mapping should return bytes) #545

Merged
merged 2 commits into from
Apr 25, 2023

Conversation

penguinolog
Copy link
Collaborator

@penguinolog penguinolog commented Apr 25, 2023

Add time.sleep(0.1) to the event loop tests:
in the worst scenario on windows and slow machine
function in parallel thread/async can wait up to 80 milliseconds (tested)
Add type annotations to the vterm and test_vterm to simplify error lookup.

Partial: #544
Partial: #512
Partial: #406

Checklist
  • I've ensured that similar functionality has not already been implemented
  • I've ensured that similar functionality has not earlier been proposed and declined
  • I've branched off the master or python-dual-support branch
  • I've merged fresh upstream into my branch recently
  • I've ran tox successfully in local environment

@penguinolog penguinolog force-pushed the test_vterm_check branch 5 times, most recently from 7e1ea53 to 34a2e06 Compare April 25, 2023 12:34
@@ -227,17 +227,17 @@ def set_state(self, state: bool | Literal['mixed'], do_callback: bool = True) ->
do_callback -- False to suppress signal from this change

>>> changes = []
>>> def callback_a(cb, state, user_data):
>>> def callback_a(user_data, cb, state):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@wardi looks like incorrect resolve order in Signals.emit: cb is part of *args -> put after user_args and before deprecated user_arg.

@@ -49,6 +49,12 @@ universal = 0
profile = "black"
line_length = 120

[tool.pytest.ini_options]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

now preparation only: warnings collected much better, but non-stable event loop tests and fully incompatible test_vterm

@@ -801,12 +801,13 @@ def render(self, size: tuple[int], focus: bool = False):
return canv


class SolidFill(BoxWidget):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

many years deprecated base class

if self._sgr_mapping or self._g[self.active] == 'ibmpc':
dec_pos = DEC_SPECIAL_CHARS.find(char.decode('cp437'))
if dec_pos >= 0:
self.current = '0'
return str(ALT_DEC_SPECIAL_CHARS[dec_pos])
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

incorrect cast, will cause BytesWarning

@@ -226,6 +240,7 @@ def test_erase_display(self):
self.expect(' x5a98765')

def test_scrolling_region_simple(self):
# TODO(Aleksei): Issue #544
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

4 tests which fail on regular basis

Copy link
Collaborator

Choose a reason for hiding this comment

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

we can mark them as flaky or to be skipped so they don't fail unrelated changes, can't we?

Add `time.sleep(0.1)` to the event loop tests:
  in the worst scenario on windows and slow machine
  function in parallel thread/async can wait up to 80 milliseconds (tested)
Add type annotations to the `vterm` and `test_vterm` to simplify error lookup.
* Fix `DeprecationWarning` in doctests & examples
* Add `pytest` configuration in `pyproject.toml` without migration
* `Signals.emit()` rework: stop `user_args` join with `weak_args`

Partial: urwid#544
Partial: urwid#512
Partial: urwid#406
``command`` is the command to execute inside the terminal,
provided as a list of the command followed by its arguments.
If 'command' is None, the command is the current user's shell.
You can also provide a callable instead of a command, which will be executed in the subprocess.
Copy link
Collaborator

Choose a reason for hiding this comment

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

seems like you almost aligned this paragraph to a new line width

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I changed split to increase readability: misread caused incomplete type annotation

* set timer for errors raise to 0: faster raise, faster test done
@penguinolog penguinolog requested a review from wardi April 25, 2023 16:17
@penguinolog penguinolog merged commit 1cc1d63 into urwid:master Apr 25, 2023
5 checks passed
@penguinolog penguinolog deleted the test_vterm_check branch September 28, 2023 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants