How to use the resolvelib.reporters.BaseReporter function in resolvelib

To help you get started, we’ve selected a few resolvelib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sarugaku / resolvelib / tests / functional / python / test_resolvers_python.py View on Github external
params=[
        pytest.param(
            os.path.join(CASE_DIR, n),
            marks=pytest.mark.xfail(strict=True, reason=XFAIL_CASES[n]),
        )
        if n in XFAIL_CASES
        else os.path.join(CASE_DIR, n)
        for n in CASE_NAMES
    ],
    ids=[n[:-5] for n in CASE_NAMES],
)
def provider(request):
    return PythonInputProvider(request.param)


class PythonTestReporter(BaseReporter):
    def __init__(self):
        self._indent = 0

    def backtracking(self, candidate):
        self._indent -= 1
        print(" " * self._indent, "Back ", candidate, sep="")

    def pinning(self, candidate):
        print(" " * self._indent, "Pin  ", candidate, sep="")
        self._indent += 1


@pytest.fixture(scope="module")
def reporter():
    return PythonTestReporter()