Problem Definition
Theme configuration in pytest-sugar.conf does not apply name parameter.
Example
Configuration file:
[theme]
path=magenta
progressbar=cyan
name=blue
Expected Outcome
All the configuration parameters under theme section must apply.
Actual Outcome
path and progressbar parameters apply (i.e., output colors changed). But the name parameter has no effect and hence the output color is unchanged.
Cause
Starting from the following line, the fields of the Theme class is traversed and the corresponding values read from the configuration.
|
fields: Tuple[dataclasses.Field, ...] = dataclasses.fields(Theme) |
However, the name field does not have a type annotation (see below line). So, it doesn't returned in the field list of the Theme class. Therefore, it is ignored and not looked up in the configuration.
Solution
Add a type annotation to the name field as follows:
class Theme:
...
name: Optional[str] = None
...
Problem Definition
Theme configuration in
pytest-sugar.confdoes not applynameparameter.Example
Configuration file:
Expected Outcome
All the configuration parameters under
themesection must apply.Actual Outcome
pathandprogressbarparameters apply (i.e., output colors changed). But thenameparameter has no effect and hence the output color is unchanged.Cause
Starting from the following line, the fields of the
Themeclass is traversed and the corresponding values read from the configuration.pytest-sugar/pytest_sugar.py
Line 144 in efafd9c
However, the
namefield does not have a type annotation (see below line). So, it doesn't returned in the field list of theThemeclass. Therefore, it is ignored and not looked up in the configuration.pytest-sugar/pytest_sugar.py
Line 51 in efafd9c
Solution
Add a type annotation to the
namefield as follows: