Open ovunccetin opened 4 days ago
Theme configuration in pytest-sugar.conf does not apply name parameter.
pytest-sugar.conf
name
Configuration file:
[theme] path=magenta progressbar=cyan name=blue
All the configuration parameters under theme section must apply.
theme
path and progressbar parameters apply (i.e., output colors changed). But the name parameter has no effect and hence the output color is unchanged.
path
progressbar
Starting from the following line, the fields of the Theme class is traversed and the corresponding values read from the configuration.
Theme
https://github.com/Teemu/pytest-sugar/blob/efafd9c0d4bfb174db2911beb414bbd4092ffc57/pytest_sugar.py#L144
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.
https://github.com/Teemu/pytest-sugar/blob/efafd9c0d4bfb174db2911beb414bbd4092ffc57/pytest_sugar.py#L51
Add a type annotation to the name field as follows:
class Theme: ... name: Optional[str] = None ...
Problem Definition
Theme configuration in
pytest-sugar.conf
does not applyname
parameter.Example
Configuration file:
Expected Outcome
All the configuration parameters under
theme
section must apply.Actual Outcome
path
andprogressbar
parameters apply (i.e., output colors changed). But thename
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.https://github.com/Teemu/pytest-sugar/blob/efafd9c0d4bfb174db2911beb414bbd4092ffc57/pytest_sugar.py#L144
However, the
name
field does not have a type annotation (see below line). So, it doesn't returned in the field list of theTheme
class. Therefore, it is ignored and not looked up in the configuration.https://github.com/Teemu/pytest-sugar/blob/efafd9c0d4bfb174db2911beb414bbd4092ffc57/pytest_sugar.py#L51
Solution
Add a type annotation to the
name
field as follows: