RedHatQE / RedHatQE/widgetastic.core

Smart is_displayed

Open
#15 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
37
Forks
46
PR merge metrics
No merged PRs in 30d

Description

Currently, we have is_displayed that only returns true or false without further explanation. It would be helpful to see which exact part of the is_displayed failed. Therefore I would propose this:

  • Create a descriptor that will be set as is_displayed instead of the property and will hold a set of rules/checks for the displayed check.
  • The descriptor would implement __nonzero__ to act as a boolean value, therefore making it usable in if and such expressions.
  • On the __nonzero__ resolution it would store the result of each partial check in some sort of dictionary.
  • It would provide a method that would either directly raise an exception or just provide an information about those checks that did not pass.
if not view.is_displayed:
    raise Exception(view.is_displayed.why)

Or something like that, this is just a concept. (the sample provided would have caching problems)

The rules would be flexible - a string could represent either widget name (it would call is_displayed on that one) or if it would not be a widget then it would assume it is an attribute to be read. It could also provide some basic checkers like you could do a value comparison ... the discussion is open.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing is_displayed implementation and reviewing how its current boolean result is used. Define the descriptor behavior, diagnostic information, rule format, and caching expectations before implementation; done means failed checks can be identified without breaking existing boolean-style usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.