Skip to content

Commit

Permalink
Move theme & options to plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
Mauko Quiroga committed Aug 20, 2021
1 parent cdfdfda commit a6923c7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
28 changes: 12 additions & 16 deletions openfisca_core/tools/reporting_plugin.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
from configparser import ConfigParser

import pytest_sugar

THEME = {
"skipped": "yellow",
"symbol_passed": ".",
"symbol_failed": "F",
"symbol_failed_not_call": "f",
"symbol_xfailed_failed": "X",
"symbol_xfailed_skipped": "x",
"symbol_skipped": "s",
}


def pytest_configure(config):
config.option.workers = "auto"
config.option.disable_warnings = True


def pytest_sessionstart(session):
config = ConfigParser()
config.read("setup.cfg")

for key in pytest_sugar.THEME:
if not config.has_option("sugar.theme", key):
continue

value = config.get("sugar.theme", key)
pytest_sugar.THEME[key] = value

if config.has_option("sugar", "progressbar_length"):
value = config.get("sugar", "progressbar_length")
pytest_sugar.LEN_PROGRESS_BAR_SETTING = value
pytest_sugar.THEME.update(THEME)
pytest_sugar.LEN_PROGRESS_BAR_SETTING = "0"


class ReportingPlugin:

pytest_configure = staticmethod(pytest_configure)
pytest_sessionstart = staticmethod(pytest_sessionstart)
12 changes: 0 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,3 @@ ignore_missing_imports = True

[mypy-openfisca_core.scripts.*]
ignore_errors = True

[sugar]
progressbar_length = 0

[sugar.theme]
skipped = yellow
symbol_passed = .
symbol_failed = F
symbol_failed_not_call = f
symbol_xfailed_failed = X
symbol_xfailed_skipped = x
symbol_skipped = s

0 comments on commit a6923c7

Please sign in to comment.