File: conftest.py

package info (click to toggle)
python-resolvelib 1.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,504 kB
  • sloc: python: 2,278; javascript: 102; sh: 9; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 664 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import pytest

from resolvelib import BaseReporter


class TestReporter(BaseReporter):
    def __init__(self):
        self._indent = 0
        self.visited = []

    def rejecting_candidate(self, criterion, candidate):
        self._indent -= 1
        self.visited.append(candidate)
        print(" " * self._indent, "Reject ", candidate, sep="")

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


@pytest.fixture(scope="session")
def reporter_cls():
    return TestReporter


@pytest.fixture()
def reporter(reporter_cls):
    return reporter_cls()