ScreenPyHQ / screenpy

Screenplay pattern base for Python automated UI test suites.
MIT License
27 stars 3 forks source link

silently answerable fails isinstance of Describable #96

Closed bandophahita closed 11 months ago

bandophahita commented 1 year ago

When using Silent to wrap a question, the get_additive_description fails to recognize the SilentlyAnswerable as being an instance of Describable.

bandophahita commented 1 year ago

I added a test that shows the error: See https://github.com/bandophahita/screenpy/commit/937085225553178b6e24a814d6687436b3551f93

  File "/Users/m.wilson/projects/screenpy/tests/test_actions.py", line 752, in test_implements_protocol
    assert isinstance(q1, Describable)
AssertionError: assert False
 +  where False = isinstance(<screenpy.actions.silently.SilentlyAnswerable object at 0x10398c310>, Describable)

It appears to occur with typing_extensions >=4.6.0. When using 4.5.0 or earlier, the error doesn't happen.

bandophahita commented 1 year ago

Importing Protocol and runtime_checkable from typing seems to fix the problem. Since we support python 3.8 or higher, this is a reasonable fix as both were added to python 3.8.

perrygoy commented 11 months ago

This appears to be fixed, thanks @bandophahita!