orangebeard-pytest 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ """Orangebeard reporting for pytest."""
2
+ from orangebeard_pytest.steps import attach, log, step
3
+
4
+ __all__ = ['step', 'log', 'attach']
@@ -0,0 +1,42 @@
1
+ """Find files (screenshots, traces, videos...) that a test produced in watched directories."""
2
+ import os
3
+ from pathlib import Path
4
+ from typing import Dict, List, Tuple
5
+
6
+ Snapshot = Dict[Path, Tuple[int, int]]
7
+
8
+
9
+ class DirectoryWatcher:
10
+ def __init__(self, root: Path):
11
+ self.root = Path(root)
12
+
13
+ def snapshot(self) -> Snapshot:
14
+ found: Snapshot = {}
15
+ if not self.root.is_dir():
16
+ return found
17
+ for folder, _, files in os.walk(self.root):
18
+ for name in files:
19
+ path = Path(folder) / name
20
+ try:
21
+ stat = path.stat()
22
+ except OSError:
23
+ continue
24
+ found[path] = (stat.st_mtime_ns, stat.st_size)
25
+ return found
26
+
27
+ def new_files(self, before: Snapshot) -> List[Path]:
28
+ """Files that are new or modified since `before` was taken."""
29
+ return sorted(path for path, signature in self.snapshot().items() if before.get(path) != signature)
30
+
31
+
32
+ def describe(path: Path) -> str:
33
+ """Human friendly label for an artifact; Playwright files are recognisable."""
34
+ name = Path(path).name
35
+ suffix = Path(path).suffix.lower()
36
+ if name == 'trace.zip':
37
+ return f'{name} (Playwright trace; view with: playwright show-trace {name})'
38
+ if suffix in ('.webm', '.mp4'):
39
+ return f'Video recording: {name}'
40
+ if suffix in ('.png', '.jpg', '.jpeg') and name.startswith('test-'):
41
+ return f'Screenshot: {name}'
42
+ return name
@@ -0,0 +1,107 @@
1
+ """Resolve the Orangebeard configuration. Precedence: command line > ini file > env vars / orangebeard.json."""
2
+ from dataclasses import dataclass, field
3
+ from pathlib import Path
4
+ from typing import List, Optional
5
+
6
+ import pytest
7
+ from orangebeard.config import AutoConfig
8
+ from orangebeard.entity.Attribute import Attribute
9
+ from orangebeard.entity.OrangebeardParameters import OrangebeardParameters
10
+
11
+ from orangebeard_pytest import mapping
12
+
13
+ REPORT_FIXTURE_MODES = ('all', 'user', 'none')
14
+
15
+ INI_OPTIONS = [
16
+ ('orangebeard_project', 'string', 'Orangebeard project name'),
17
+ ('orangebeard_testset', 'string', 'Orangebeard test set name (default: name of the rootdir)'),
18
+ ('orangebeard_description', 'string', 'Description of the test run'),
19
+ ('orangebeard_log_level', 'string', 'Minimum logging level reported as logs (default: INFO)'),
20
+ ('orangebeard_report_fixtures', 'string', 'Report fixtures as steps: all, user (default) or none'),
21
+ ('orangebeard_max_attachment_mb', 'string', 'Attachments larger than this are skipped (default: 50)'),
22
+ ('orangebeard_watch_dirs', 'linelist', 'Extra directories whose new files are attached to the test'),
23
+ ]
24
+
25
+
26
+ @dataclass
27
+ class Settings:
28
+ params: OrangebeardParameters
29
+ log_level: int = 20 # logging.INFO
30
+ report_fixtures: str = 'user'
31
+ max_attachment_bytes: int = 50 * 1024 * 1024
32
+ watch_dirs: List[Path] = field(default_factory=list)
33
+
34
+ @property
35
+ def report_url(self) -> str:
36
+ return f'{(self.params.endpoint or "").rstrip("/")}/p/{self.params.project}/test-results'
37
+
38
+
39
+ def add_options(parser) -> None:
40
+ group = parser.getgroup('orangebeard', 'Orangebeard reporting')
41
+ group.addoption('--orangebeard', action='store_true', dest='orangebeard', default=False,
42
+ help='Force reporting to Orangebeard (error when the configuration is incomplete).')
43
+ group.addoption('--ob-no-report', action='store_true', dest='ob_no_report', default=False,
44
+ help='Do not report to Orangebeard, even when it is configured.')
45
+ group.addoption('--ob-endpoint', dest='ob_endpoint', default=None, help='Orangebeard endpoint URL.')
46
+ group.addoption('--ob-project', dest='ob_project', default=None, help='Orangebeard project name.')
47
+ group.addoption('--ob-testset', dest='ob_testset', default=None, help='Orangebeard test set name.')
48
+ group.addoption('--ob-description', dest='ob_description', default=None, help='Test run description.')
49
+ group.addoption('--ob-attribute', dest='ob_attribute', action='append', default=None,
50
+ help="Test run attribute 'key:value' or 'tag' (repeatable).")
51
+ for name, kind, help_text in INI_OPTIONS:
52
+ parser.addini(name, help_text, type=kind, default=[] if kind == 'linelist' else '')
53
+
54
+
55
+ def _parse_attribute(text: str) -> Attribute:
56
+ key, sep, value = text.partition(':')
57
+ return Attribute(key, value) if sep else Attribute(None, text)
58
+
59
+
60
+ def resolve(config) -> Optional[Settings]:
61
+ """Return Settings when reporting is active, None when the plugin should stay inert."""
62
+ if config.getoption('ob_no_report', False):
63
+ return None
64
+
65
+ rootpath = Path(config.rootpath)
66
+ params = AutoConfig.get_config(str(rootpath))
67
+
68
+ for option, ini, attr in (('ob_endpoint', None, 'endpoint'), ('ob_project', 'orangebeard_project', 'project'),
69
+ ('ob_testset', 'orangebeard_testset', 'testset'),
70
+ ('ob_description', 'orangebeard_description', 'description')):
71
+ value = config.getoption(option, None) or (config.getini(ini) if ini else '')
72
+ if value:
73
+ setattr(params, attr, value)
74
+
75
+ attributes = list(params.attributes or [])
76
+ attributes.extend(_parse_attribute(a) for a in (config.getoption('ob_attribute', None) or []))
77
+ params.attributes = attributes
78
+
79
+ required = {'endpoint': 'ORANGEBEARD_ENDPOINT', 'token': 'ORANGEBEARD_TOKEN', 'project': 'ORANGEBEARD_PROJECT'}
80
+ missing = [env for attr, env in required.items() if not getattr(params, attr)]
81
+ if missing:
82
+ if config.getoption('orangebeard', False):
83
+ raise pytest.UsageError(
84
+ f'--orangebeard was given, but the configuration is incomplete. Missing: {", ".join(missing)} '
85
+ '(set the environment variables or add them to orangebeard.json).')
86
+ return None
87
+
88
+ if not params.testset:
89
+ params.testset = rootpath.name
90
+
91
+ report_fixtures = (config.getini('orangebeard_report_fixtures') or 'user').strip().lower()
92
+ if report_fixtures not in REPORT_FIXTURE_MODES:
93
+ raise pytest.UsageError(f'orangebeard_report_fixtures must be one of {", ".join(REPORT_FIXTURE_MODES)}')
94
+ try:
95
+ log_level = mapping.parse_level(config.getini('orangebeard_log_level') or 'INFO')
96
+ except ValueError as error:
97
+ raise pytest.UsageError(f'orangebeard_log_level: {error}')
98
+ max_mb = float(config.getini('orangebeard_max_attachment_mb') or 50)
99
+
100
+ watch_dirs = [rootpath / line.strip() for line in (config.getini('orangebeard_watch_dirs') or []) if line.strip()]
101
+ playwright_output = config.getoption('output', None) # added by pytest-playwright
102
+ if playwright_output:
103
+ invocation = getattr(getattr(config, 'invocation_params', None), 'dir', rootpath)
104
+ watch_dirs.append(Path(invocation) / playwright_output)
105
+
106
+ return Settings(params=params, log_level=log_level, report_fixtures=report_fixtures,
107
+ max_attachment_bytes=int(max_mb * 1024 * 1024), watch_dirs=watch_dirs)
@@ -0,0 +1,18 @@
1
+ """Process wide pointer to the active reporter, so test code can use step()/log()/attach() without wiring."""
2
+ _active = None
3
+
4
+
5
+ def activate(reporter):
6
+ """Make `reporter` the active one; returns a token for deactivate()."""
7
+ global _active
8
+ previous, _active = _active, reporter
9
+ return previous
10
+
11
+
12
+ def deactivate(token) -> None:
13
+ global _active
14
+ _active = token
15
+
16
+
17
+ def current():
18
+ return _active
@@ -0,0 +1,93 @@
1
+ """Pure mapping functions between pytest concepts and Orangebeard concepts."""
2
+ import logging
3
+ from typing import Dict, List, Tuple
4
+
5
+ from orangebeard.entity.Attribute import Attribute
6
+ from orangebeard.entity.LogLevel import LogLevel
7
+ from orangebeard.entity.TestStatus import TestStatus
8
+
9
+ # markers that carry pytest behaviour rather than meaning for a human reader
10
+ BUILTIN_MARKERS = {'parametrize', 'skip', 'skipif', 'xfail', 'usefixtures', 'filterwarnings'}
11
+
12
+
13
+ def split_nodeid(nodeid: str) -> Tuple[List[str], str]:
14
+ """'pkg/test_m.py::TestA::test_x[p]' -> (['pkg', 'test_m.py', 'TestA'], 'test_x[p]')
15
+
16
+ Parametrize ids (everything from the first '[') may contain '/' or '::' and are never split.
17
+ """
18
+ bracket = nodeid.find('[')
19
+ base, params = (nodeid, '') if bracket < 0 else (nodeid[:bracket], nodeid[bracket:])
20
+ path, *rest = base.split('::')
21
+ suites = [part for part in path.split('/') if part]
22
+ if not rest:
23
+ return suites[:-1], suites[-1] + params if suites else params
24
+ return suites + rest[:-1], rest[-1] + params
25
+
26
+
27
+ def phase_status(outcome: str) -> TestStatus:
28
+ return {'passed': TestStatus.PASSED, 'failed': TestStatus.FAILED, 'skipped': TestStatus.SKIPPED}.get(
29
+ outcome, TestStatus.FAILED)
30
+
31
+
32
+ def test_status(reports: Dict[str, object]) -> TestStatus:
33
+ """Overall status from the setup/call/teardown reports of one test.
34
+
35
+ Any failure (setup error, test failure, teardown error, strict xpass) fails the test. Skips and xfails are
36
+ reported as SKIPPED. A non strict xpass counts as passed.
37
+ """
38
+ if any(r.outcome == 'failed' for r in reports.values()):
39
+ return TestStatus.FAILED
40
+ for phase in ('setup', 'call'):
41
+ report = reports.get(phase)
42
+ if report is not None and report.outcome == 'skipped':
43
+ return TestStatus.SKIPPED
44
+ return TestStatus.PASSED
45
+
46
+
47
+ test_status.__test__ = False # not a test, despite its name
48
+
49
+
50
+ def log_level(levelno: int) -> LogLevel:
51
+ if levelno >= logging.ERROR:
52
+ return LogLevel.ERROR
53
+ if levelno >= logging.WARNING:
54
+ return LogLevel.WARN
55
+ if levelno >= logging.INFO:
56
+ return LogLevel.INFO
57
+ return LogLevel.DEBUG
58
+
59
+
60
+ def normalize_level(level) -> LogLevel:
61
+ """Accept LogLevel members or loose strings such as 'warn', 'WARNING', 'critical'."""
62
+ if isinstance(level, LogLevel):
63
+ return level
64
+ name = str(level).strip().upper()
65
+ if name in ('WARN', 'WARNING'):
66
+ return LogLevel.WARN
67
+ if name in ('ERROR', 'CRITICAL', 'FATAL'):
68
+ return LogLevel.ERROR
69
+ if name == 'DEBUG':
70
+ return LogLevel.DEBUG
71
+ return LogLevel.INFO
72
+
73
+
74
+ def parse_level(value: str) -> int:
75
+ """'INFO' / 'warning' / '15' -> logging level number."""
76
+ value = str(value).strip()
77
+ if value.isdigit():
78
+ return int(value)
79
+ number = logging.getLevelName(value.upper())
80
+ if not isinstance(number, int):
81
+ raise ValueError(f'Unknown log level: {value!r}')
82
+ return number
83
+
84
+
85
+ def marker_attributes(item) -> List[Attribute]:
86
+ """Custom markers become value-only attributes (tags)."""
87
+ seen, attributes = set(), []
88
+ for marker in item.iter_markers():
89
+ if marker.name in BUILTIN_MARKERS or marker.name in seen:
90
+ continue
91
+ seen.add(marker.name)
92
+ attributes.append(Attribute(None, marker.name))
93
+ return attributes
@@ -0,0 +1,228 @@
1
+ """pytest hooks. Thin by design: everything of substance lives in reporter/mapping/artifacts."""
2
+ import inspect
3
+ import logging
4
+ import threading
5
+ import warnings
6
+ from typing import Optional
7
+
8
+ import pytest
9
+ from orangebeard.entity.LogFormat import LogFormat
10
+ from orangebeard.entity.LogLevel import LogLevel
11
+ from orangebeard.entity.TestStatus import TestStatus
12
+
13
+ from orangebeard_pytest import artifacts, config as ob_config, context, mapping
14
+ from orangebeard_pytest.reporter import OrangebeardReporter
15
+ from orangebeard_pytest.steps import OrangebeardApi
16
+
17
+ PHASES = ('setup', 'call', 'teardown')
18
+ # loggers whose records come from the reporting machinery itself: never report them (feedback loop)
19
+ IGNORED_LOGGERS = ('orangebeard', 'aiohttp', 'asyncio')
20
+
21
+
22
+ def create_client(params, settings):
23
+ """Factory for the Orangebeard client (replaced in the plugin's own tests)."""
24
+ from orangebeard.OrangebeardClient import OrangebeardClient
25
+ return OrangebeardClient(orangebeard_config=params)
26
+
27
+
28
+ def pytest_addoption(parser):
29
+ ob_config.add_options(parser)
30
+
31
+
32
+ def pytest_configure(config):
33
+ config.addinivalue_line('markers', 'orangebeard: reserved for Orangebeard specific markers')
34
+ if hasattr(config, 'workerinput'): # pytest-xdist worker: not supported (yet)
35
+ return
36
+ settings = ob_config.resolve(config)
37
+ if settings is None:
38
+ return
39
+ if getattr(config.option, 'numprocesses', None):
40
+ warnings.warn('orangebeard-pytest does not support pytest-xdist (-n) yet; reporting is disabled.',
41
+ stacklevel=1)
42
+ return
43
+ config.pluginmanager.register(OrangebeardPlugin(config, settings), 'orangebeard-reporter')
44
+
45
+
46
+ @pytest.fixture
47
+ def orangebeard():
48
+ """Gives tests step(), log() and attach() (same as `import orangebeard_pytest`)."""
49
+ return OrangebeardApi()
50
+
51
+
52
+ class _PhaseLogHandler(logging.Handler):
53
+ def __init__(self, reporter: OrangebeardReporter, level: int):
54
+ super().__init__(level)
55
+ self.reporter = reporter
56
+ self.thread = threading.get_ident()
57
+ self._busy = False
58
+
59
+ def emit(self, record: logging.LogRecord) -> None:
60
+ if self._busy or threading.get_ident() != self.thread or record.name.startswith(IGNORED_LOGGERS):
61
+ return
62
+ self._busy = True
63
+ try:
64
+ message = record.getMessage()
65
+ if record.exc_info:
66
+ message += '\n' + logging.Formatter().formatException(record.exc_info)
67
+ self.reporter.log(message, mapping.log_level(record.levelno))
68
+ except Exception:
69
+ pass
70
+ finally:
71
+ self._busy = False
72
+
73
+
74
+ def _is_user_fixture(fixturedef) -> bool:
75
+ func = getattr(fixturedef, 'func', None)
76
+ if (getattr(func, '__module__', '') or '').startswith('_pytest'):
77
+ return False
78
+ filename = getattr(getattr(func, '__code__', None), 'co_filename', '') or ''
79
+ return not any(part in filename for part in ('site-packages', 'dist-packages'))
80
+
81
+
82
+ class OrangebeardPlugin:
83
+ """Registered only when Orangebeard is configured."""
84
+
85
+ def __init__(self, config, settings: ob_config.Settings):
86
+ self.config = config
87
+ self.settings = settings
88
+ self.reporter: Optional[OrangebeardReporter] = None
89
+ self.reports = {}
90
+ self.watchers = [artifacts.DirectoryWatcher(path) for path in settings.watch_dirs]
91
+ self._previous_context = None
92
+
93
+ # ------------------------------------------------------------------ run
94
+
95
+ def pytest_sessionstart(self, session):
96
+ try:
97
+ client = create_client(self.settings.params, self.settings)
98
+ except Exception as error:
99
+ warnings.warn(f'Orangebeard reporting disabled, could not create the client: {error}')
100
+ return
101
+ self.reporter = OrangebeardReporter(client, self.settings)
102
+ self.reporter.start_run()
103
+ self._previous_context = context.activate(self.reporter)
104
+
105
+ def pytest_sessionfinish(self, session):
106
+ if self.reporter is None:
107
+ return
108
+ self.reporter.finish_run()
109
+ context.deactivate(self._previous_context)
110
+
111
+ def pytest_terminal_summary(self, terminalreporter):
112
+ if self.reporter is None:
113
+ return
114
+ terminalreporter.write_sep('-', 'Orangebeard')
115
+ terminalreporter.write_line(f'Orangebeard: results reported to {self.settings.report_url}')
116
+ for problem in self.reporter.problems:
117
+ terminalreporter.write_line(f'Orangebeard: problem while reporting - {problem}', yellow=True)
118
+
119
+ # ------------------------------------------------------------------ test
120
+
121
+ @pytest.hookimpl(wrapper=True)
122
+ def pytest_runtest_protocol(self, item, nextitem):
123
+ reporter = self.reporter
124
+ if reporter is None:
125
+ return (yield)
126
+ reporter.start_test(item.nodeid, self._description(item), self._attributes(item))
127
+ self.reports = {}
128
+ before = [watcher.snapshot() for watcher in self.watchers]
129
+ try:
130
+ return (yield)
131
+ finally:
132
+ for watcher, snapshot in zip(self.watchers, before):
133
+ for path in watcher.new_files(snapshot):
134
+ self._attach_file(path)
135
+ reporter.finish_test(mapping.test_status(self.reports) if self.reports else TestStatus.FAILED)
136
+
137
+ @staticmethod
138
+ def _description(item):
139
+ try:
140
+ return inspect.getdoc(getattr(item, 'obj', None)) or None
141
+ except Exception:
142
+ return None
143
+
144
+ @staticmethod
145
+ def _attributes(item):
146
+ try:
147
+ return mapping.marker_attributes(item)
148
+ except Exception:
149
+ return []
150
+
151
+ def _attach_file(self, path):
152
+ try:
153
+ self.reporter.attach(path.name, path.read_bytes(), description=artifacts.describe(path))
154
+ except OSError as error:
155
+ self.reporter.problems.append(f'attach {path}: {error}')
156
+
157
+ # ------------------------------------------------------------------ phases
158
+
159
+ def _phase(self, name):
160
+ reporter = self.reporter
161
+ if reporter is None:
162
+ return (yield)
163
+ reporter.start_step(name)
164
+ handler = _PhaseLogHandler(reporter, self.settings.log_level)
165
+ root = logging.getLogger()
166
+ previous_level = root.level
167
+ if root.level > self.settings.log_level:
168
+ root.setLevel(self.settings.log_level)
169
+ root.addHandler(handler)
170
+ try:
171
+ return (yield)
172
+ finally:
173
+ root.removeHandler(handler)
174
+ root.setLevel(previous_level)
175
+
176
+ @pytest.hookimpl(wrapper=True)
177
+ def pytest_runtest_setup(self, item):
178
+ return (yield from self._phase('setup'))
179
+
180
+ @pytest.hookimpl(wrapper=True)
181
+ def pytest_runtest_call(self, item):
182
+ return (yield from self._phase('call'))
183
+
184
+ @pytest.hookimpl(wrapper=True)
185
+ def pytest_runtest_teardown(self, item, nextitem):
186
+ return (yield from self._phase('teardown'))
187
+
188
+ def pytest_runtest_logreport(self, report):
189
+ reporter = self.reporter
190
+ if reporter is None or report.when not in PHASES:
191
+ return
192
+ self.reports[report.when] = report
193
+ for title, content in report.sections:
194
+ if title.startswith('Captured stdout'):
195
+ reporter.log(content, LogLevel.INFO)
196
+ elif title.startswith('Captured stderr'):
197
+ reporter.log(content, LogLevel.WARN)
198
+ if report.failed:
199
+ reporter.log(f'```\n{report.longreprtext}\n```', LogLevel.ERROR, LogFormat.MARKDOWN)
200
+ elif report.skipped:
201
+ reason = getattr(report, 'wasxfail', None)
202
+ if reason is not None:
203
+ reporter.log(f'xfailed: {reason}', LogLevel.INFO)
204
+ else:
205
+ longrepr = report.longrepr
206
+ reporter.log(str(longrepr[2] if isinstance(longrepr, tuple) else longrepr), LogLevel.INFO)
207
+ reporter.close_open_steps(mapping.phase_status(report.outcome))
208
+
209
+ # ------------------------------------------------------------------ fixtures
210
+
211
+ def _wants_fixture(self, fixturedef) -> bool:
212
+ mode = self.settings.report_fixtures
213
+ return mode == 'all' or (mode == 'user' and _is_user_fixture(fixturedef))
214
+
215
+ @pytest.hookimpl(wrapper=True)
216
+ def pytest_fixture_setup(self, fixturedef, request):
217
+ reporter = self.reporter
218
+ if reporter is None or not reporter.in_test or not self._wants_fixture(fixturedef):
219
+ return (yield)
220
+ reporter.start_step(f'fixture: {fixturedef.argname}')
221
+ try:
222
+ result = yield
223
+ except BaseException as error:
224
+ skipped = isinstance(error, pytest.skip.Exception)
225
+ reporter.finish_step(TestStatus.SKIPPED if skipped else TestStatus.FAILED)
226
+ raise
227
+ reporter.finish_step(TestStatus.PASSED)
228
+ return result
@@ -0,0 +1,155 @@
1
+ """Translates the pytest lifecycle into Orangebeard calls. Knows nothing about pytest hooks; never raises."""
2
+ import functools
3
+ from datetime import datetime
4
+ from typing import List, Optional
5
+
6
+ from orangebeard.entity.Attachment import Attachment, AttachmentFile, AttachmentMetaData
7
+ from orangebeard.entity.FinishStep import FinishStep
8
+ from orangebeard.entity.FinishTest import FinishTest
9
+ from orangebeard.entity.FinishTestRun import FinishTestRun
10
+ from orangebeard.entity.Log import Log
11
+ from orangebeard.entity.LogFormat import LogFormat
12
+ from orangebeard.entity.LogLevel import LogLevel
13
+ from orangebeard.entity.StartStep import StartStep
14
+ from orangebeard.entity.StartSuite import StartSuite
15
+ from orangebeard.entity.StartTest import StartTest
16
+ from orangebeard.entity.StartTestRun import StartTestRun
17
+ from orangebeard.entity.TestStatus import TestStatus
18
+ from orangebeard.entity.TestType import TestType
19
+
20
+ from orangebeard_pytest import mapping
21
+ from orangebeard_pytest.config import Settings
22
+
23
+
24
+ def _now() -> datetime:
25
+ return datetime.now().astimezone()
26
+
27
+
28
+ def _safe(method):
29
+ """Reporting problems must never fail or break a test run: remember them for the terminal summary."""
30
+
31
+ @functools.wraps(method)
32
+ def wrapper(self, *args, **kwargs):
33
+ try:
34
+ return method(self, *args, **kwargs)
35
+ except Exception as error:
36
+ self.problems.append(f'{method.__name__}: {error}')
37
+ return None
38
+
39
+ return wrapper
40
+
41
+
42
+ class OrangebeardReporter:
43
+ def __init__(self, client, settings: Settings):
44
+ self.client = client
45
+ self.settings = settings
46
+ self.problems: List[str] = []
47
+ self.run_uuid = None
48
+ self.test_uuid = None
49
+ self._suites = {}
50
+ self._steps: list = []
51
+
52
+ @property
53
+ def in_test(self) -> bool:
54
+ return self.run_uuid is not None and self.test_uuid is not None
55
+
56
+ @property
57
+ def current_step(self):
58
+ return self._steps[-1] if self._steps else None
59
+
60
+ # ------------------------------------------------------------------ run
61
+
62
+ @_safe
63
+ def start_run(self):
64
+ params = self.settings.params
65
+ self.run_uuid = self.client.start_test_run(
66
+ StartTestRun(params.testset, _now(), params.description, list(params.attributes or [])))
67
+
68
+ @_safe
69
+ def finish_run(self):
70
+ if self.run_uuid is not None:
71
+ self.client.finish_test_run(self.run_uuid, FinishTestRun(_now()))
72
+ self.client.close()
73
+
74
+ # ------------------------------------------------------------------ test
75
+
76
+ @_safe
77
+ def start_test(self, nodeid: str, description: Optional[str] = None, attributes=None):
78
+ if self.run_uuid is None:
79
+ return None
80
+ suites, name = mapping.split_nodeid(nodeid)
81
+ suite_uuid = self._ensure_suites(suites)
82
+ self.test_uuid = self.client.start_test(
83
+ StartTest(self.run_uuid, suite_uuid, name, _now(), TestType.TEST, description, attributes or None))
84
+ self._steps = []
85
+ return self.test_uuid
86
+
87
+ def _ensure_suites(self, suites: List[str]):
88
+ known = 0
89
+ for depth in range(len(suites), 0, -1):
90
+ if tuple(suites[:depth]) in self._suites:
91
+ known = depth
92
+ break
93
+ if known < len(suites):
94
+ parent = self._suites.get(tuple(suites[:known]))
95
+ uuids = self.client.start_suite(StartSuite(self.run_uuid, suites[known:], parent))
96
+ for offset, suite_uuid in enumerate(uuids):
97
+ self._suites[tuple(suites[:known + offset + 1])] = suite_uuid
98
+ return self._suites[tuple(suites)]
99
+
100
+ @_safe
101
+ def finish_test(self, status: TestStatus):
102
+ if not self.in_test:
103
+ return
104
+ self.close_open_steps(status)
105
+ self.client.finish_test(self.test_uuid, FinishTest(self.run_uuid, status, _now()))
106
+ self.test_uuid = None
107
+ self._steps = []
108
+
109
+ # ------------------------------------------------------------------ steps
110
+
111
+ @_safe
112
+ def start_step(self, name: str, description: Optional[str] = None):
113
+ if not self.in_test:
114
+ return None
115
+ step_uuid = self.client.start_step(
116
+ StartStep(self.run_uuid, self.test_uuid, name, _now(), self.current_step, description))
117
+ self._steps.append(step_uuid)
118
+ return step_uuid
119
+
120
+ @_safe
121
+ def finish_step(self, status: TestStatus):
122
+ if self._steps:
123
+ step_uuid = self._steps.pop()
124
+ self.client.finish_step(step_uuid, FinishStep(self.run_uuid, status, _now()))
125
+
126
+ def close_open_steps(self, status: TestStatus):
127
+ while self._steps:
128
+ self.finish_step(status)
129
+
130
+ # ------------------------------------------------------------------ logs and attachments
131
+
132
+ @_safe
133
+ def log(self, message: str, level=LogLevel.INFO, fmt: LogFormat = LogFormat.PLAIN_TEXT):
134
+ if not self.in_test:
135
+ return
136
+ self.client.log_batch(Log(self.run_uuid, self.test_uuid, message, mapping.normalize_level(level), fmt,
137
+ self.current_step, _now()))
138
+
139
+ @_safe
140
+ def attach(self, name: str, content: bytes, description: Optional[str] = None, content_type: str = None):
141
+ if not self.in_test:
142
+ return
143
+ if len(content) > self.settings.max_attachment_bytes:
144
+ self.log(f'Attachment {name} skipped: {len(content)} bytes exceeds orangebeard_max_attachment_mb',
145
+ LogLevel.WARN)
146
+ return
147
+ step = self.current_step
148
+ # an attachment hangs on a log entry, which needs an id: use the non-batched log call
149
+ log_uuid = self.client.log(Log(self.run_uuid, self.test_uuid, f'Attachment: {description or name}',
150
+ LogLevel.INFO, LogFormat.PLAIN_TEXT, step, _now()))
151
+ attachment_file = AttachmentFile(name, content)
152
+ if content_type:
153
+ attachment_file.contentType = content_type
154
+ self.client.send_attachment(
155
+ Attachment(attachment_file, AttachmentMetaData(self.run_uuid, self.test_uuid, log_uuid, step)))
@@ -0,0 +1,79 @@
1
+ """Public API for test code: step(), log(), attach(). All of it is a no-op when Orangebeard is not active."""
2
+ from contextlib import ContextDecorator
3
+ from pathlib import Path
4
+ from typing import Optional, Union
5
+
6
+ import pytest
7
+ from orangebeard.entity.LogLevel import LogLevel
8
+ from orangebeard.entity.TestStatus import TestStatus
9
+
10
+ from orangebeard_pytest import context
11
+
12
+
13
+ class step(ContextDecorator):
14
+ """Report a (nested) step. Usable as `with step("name"):` and as `@step("name")` / `@step()`."""
15
+
16
+ def __init__(self, name: Optional[str] = None, description: Optional[str] = None):
17
+ self.name = name
18
+ self.description = description
19
+ self._started = False
20
+
21
+ def __call__(self, func):
22
+ if self.name is None:
23
+ self.name = func.__name__
24
+ return super().__call__(func)
25
+
26
+ def _recreate_cm(self):
27
+ return step(self.name, self.description) # a fresh instance per call (recursion / concurrency safe)
28
+
29
+ def __enter__(self):
30
+ reporter = context.current()
31
+ if reporter is not None:
32
+ self._started = reporter.start_step(self.name or 'step', self.description) is not None
33
+ return self
34
+
35
+ def __exit__(self, exc_type, exc, tb):
36
+ reporter = context.current()
37
+ if reporter is None or not self._started:
38
+ return False
39
+ if exc_type is None:
40
+ status = TestStatus.PASSED
41
+ elif issubclass(exc_type, (pytest.skip.Exception, pytest.xfail.Exception)):
42
+ status = TestStatus.SKIPPED
43
+ else:
44
+ status = TestStatus.FAILED
45
+ reporter.log(f'{exc_type.__name__}: {exc}', LogLevel.ERROR)
46
+ reporter.finish_step(status)
47
+ return False
48
+
49
+
50
+ def log(message: str, level: Union[str, LogLevel] = 'info') -> None:
51
+ """Send a log message to the current step (or test)."""
52
+ reporter = context.current()
53
+ if reporter is not None:
54
+ reporter.log(str(message), level)
55
+
56
+
57
+ def attach(source: Union[bytes, str, Path], name: Optional[str] = None, content_type: Optional[str] = None) -> None:
58
+ """Attach a file (path) or raw bytes (give a name) to the current step (or test)."""
59
+ if isinstance(source, (bytes, bytearray)):
60
+ if not name:
61
+ raise ValueError('attach() needs a name when given raw bytes')
62
+ content = bytes(source)
63
+ else:
64
+ path = Path(source)
65
+ name = name or path.name
66
+ content = None
67
+ reporter = context.current()
68
+ if reporter is None:
69
+ return
70
+ if content is None:
71
+ content = path.read_bytes()
72
+ reporter.attach(name, content, content_type=content_type)
73
+
74
+
75
+ class OrangebeardApi:
76
+ """What the `orangebeard` fixture hands to tests."""
77
+ step = staticmethod(step)
78
+ log = staticmethod(log)
79
+ attach = staticmethod(attach)
@@ -0,0 +1,158 @@
1
+ Metadata-Version: 2.4
2
+ Name: orangebeard-pytest
3
+ Version: 0.1.0
4
+ Summary: Orangebeard reporting plugin for pytest (including pytest-playwright)
5
+ Author-email: Orangebeard <info@orangebeard.io>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/orangebeard-io/pytest-listener
8
+ Project-URL: Bug Tracker, https://github.com/orangebeard-io/pytest-listener/issues
9
+ Keywords: pytest,orangebeard,test reporting,playwright
10
+ Classifier: Framework :: Pytest
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.10
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Software Development :: Testing
18
+ Requires-Python: >=3.10
19
+ Description-Content-Type: text/markdown
20
+ License-File: LICENSE
21
+ Requires-Dist: pytest>=7.4
22
+ Requires-Dist: orangebeard-client>=2.8.0
23
+ Provides-Extra: test
24
+ Requires-Dist: pytest-playwright>=0.5; extra == "test"
25
+ Dynamic: license-file
26
+
27
+ # orangebeard-pytest
28
+
29
+ [Orangebeard](https://orangebeard.io) reporting plugin for [pytest](https://pytest.org), including
30
+ [pytest-playwright](https://github.com/microsoft/playwright-pytest).
31
+
32
+ * Suites, tests and steps: directories, modules and classes become nested suites; every test has `setup`, `call` and
33
+ `teardown` steps, fixtures become sub steps, and you can add your own nested steps.
34
+ * Logs: `logging` records, captured stdout/stderr, failure details, skip and xfail reasons.
35
+ * Attachments: anything you attach, plus the screenshots, traces and videos pytest-playwright produces.
36
+ * Never gets in the way: when Orangebeard is not configured the plugin does nothing, and reporting problems never
37
+ fail your tests.
38
+
39
+ ## Install
40
+
41
+ ```shell
42
+ pip install orangebeard-pytest
43
+ ```
44
+
45
+ The plugin is picked up automatically by pytest (entry point `pytest11`).
46
+
47
+ ## Configure
48
+
49
+ Configuration is shared with the other Orangebeard listeners. Environment variables or an `orangebeard.json`
50
+ (searched from the pytest rootdir upwards):
51
+
52
+ ```json
53
+ {
54
+ "endpoint": "https://app.orangebeard.io/{your-organization}",
55
+ "token": "00000000-0000-0000-0000-000000000000",
56
+ "project": "my-project",
57
+ "testset": "nightly",
58
+ "description": "Nightly regression",
59
+ "attributes": [{"key": "env", "value": "acceptance"}, {"value": "smoke"}]
60
+ }
61
+ ```
62
+
63
+ | Setting | Environment variable | pytest option / ini |
64
+ |------------------|-------------------------|-------------------------------------------|
65
+ | Endpoint | `ORANGEBEARD_ENDPOINT` | `--ob-endpoint` |
66
+ | Access token | `ORANGEBEARD_TOKEN` | (environment or `orangebeard.json` only) |
67
+ | Project | `ORANGEBEARD_PROJECT` | `--ob-project`, `orangebeard_project` |
68
+ | Test set | `ORANGEBEARD_TESTSET` | `--ob-testset`, `orangebeard_testset` |
69
+ | Description | `ORANGEBEARD_DESCRIPTION` | `--ob-description`, `orangebeard_description` |
70
+ | Attributes | `ORANGEBEARD_ATTRIBUTES` (`key:value;tag`) | `--ob-attribute key:value` (repeatable) |
71
+ | Existing run | `ORANGEBEARD_TESTRUN_UUID` | (report into an announced run; finish it with the Orangebeard CLI) |
72
+
73
+ Precedence: command line, then ini file, then environment / `orangebeard.json`. The test set defaults to the name of
74
+ the rootdir. Reporting is active as soon as endpoint, token and project are known.
75
+
76
+ Other options:
77
+
78
+ | Option | Meaning |
79
+ |-----------------------------------------|-------------------------------------------------------------------|
80
+ | `--orangebeard` | Fail with a clear error when the configuration is incomplete |
81
+ | `--ob-no-report` | Switch reporting off |
82
+ | `orangebeard_log_level` (default INFO) | Minimum `logging` level that is reported |
83
+ | `orangebeard_report_fixtures` | `user` (default), `all` or `none`: fixtures reported as steps |
84
+ | `orangebeard_max_attachment_mb` (50) | Larger attachments are skipped (with a warning log) |
85
+ | `orangebeard_watch_dirs` | Extra directories; files a test creates there are attached |
86
+
87
+ ## Steps, logs and attachments in your tests
88
+
89
+ ```python
90
+ import orangebeard_pytest as ob
91
+
92
+ def test_checkout(page):
93
+ with ob.step("Add item to cart"):
94
+ page.click("#add")
95
+ with ob.step("Verify badge"):
96
+ assert page.inner_text("#badge") == "1"
97
+ ob.log("cart looks fine", level="info")
98
+ ob.attach(b"{...}", name="cart.json") # bytes need a name
99
+ ob.attach("reports/summary.html") # or a path
100
+
101
+ @ob.step("Log in") # also usable as a decorator
102
+ def login(page): ...
103
+ ```
104
+
105
+ The same functions are available through the `orangebeard` fixture. Outside an Orangebeard run they do nothing, so
106
+ your tests also work without the plugin configured.
107
+
108
+ ## Playwright
109
+
110
+ Nothing to configure. Everything pytest-playwright writes to its `--output` directory while a test runs (screenshots,
111
+ `trace.zip`, videos) is attached to that test, honouring `--screenshot`, `--tracing` and `--video`:
112
+
113
+ ```shell
114
+ pytest --screenshot only-on-failure --tracing retain-on-failure --video retain-on-failure
115
+ ```
116
+
117
+ Open a downloaded trace with `playwright show-trace trace.zip`.
118
+
119
+ ## How it is reported
120
+
121
+ ```
122
+ suite tests (directory)
123
+ └ suite test_cart.py (module)
124
+ └ suite TestCart (class)
125
+ └ test test_checkout[chromium]
126
+ ├ step setup
127
+ │ └ step fixture: my_database
128
+ ├ step call
129
+ │ └ step Add item to cart
130
+ │ └ step Verify badge
131
+ └ step teardown
132
+ ```
133
+
134
+ A test fails on any setup error, test failure, teardown error or strict xpass. Skipped and xfailed tests are
135
+ `SKIPPED`.
136
+
137
+ ## Limitations
138
+
139
+ * `pytest-xdist` (`-n`) is not supported yet; reporting is disabled with a warning when it is used.
140
+ * Fixture finalizers are not reported as separate steps; their output ends up in the `teardown` step.
141
+ * While a phase runs the root logger level is lowered to `orangebeard_log_level` so records reach the reporter.
142
+
143
+ ## Development
144
+
145
+ ```shell
146
+ pip install -e ".[test]"
147
+ python -m pytest
148
+ ```
149
+
150
+ The Playwright tests need a browser: `playwright install chromium`.
151
+
152
+ The suite reports itself to Orangebeard (`orangebeard.json`: project `listeners`) when `ORANGEBEARD_TOKEN` is set,
153
+ locally via a git-ignored `.env` (see `.env.example`), in GitHub Actions via the `ORANGEBEARD_TOKEN` secret.
154
+ Without a token nothing is reported.
155
+
156
+ ## License
157
+
158
+ Apache-2.0
@@ -0,0 +1,14 @@
1
+ orangebeard_pytest/__init__.py,sha256=SPRog9VdpAJcL2TqKt8mMkpI6bK6rm6cQGLDCXQ0cyo,132
2
+ orangebeard_pytest/artifacts.py,sha256=hSWYRdKjgLNIQAHwycabRLY_PUN2HAar58syIHb-1YY,1495
3
+ orangebeard_pytest/config.py,sha256=g3cy_qpS5ZOnfFmD3F8aIPq9k_xC-EW1FnpXV1k8rA4,5511
4
+ orangebeard_pytest/context.py,sha256=OrwPdA9vkGH4ep3eF6-R-m1K9k4y-QfvGW9bzZR6c-E,416
5
+ orangebeard_pytest/mapping.py,sha256=kKAr4DUFJy6v5N9mn09rAFILtjNQjYH55xx7JsmP-Tg,3346
6
+ orangebeard_pytest/plugin.py,sha256=c6502hvPFBslerU4E6vYrwBqq_u2u5w4OxXEf3SSLgU,8809
7
+ orangebeard_pytest/reporter.py,sha256=dDlvzDrEHicGBaItBW03MYpZ0y7y82HaGG_35aa06BY,6072
8
+ orangebeard_pytest/steps.py,sha256=ICMQrQCkQyXF-8EzCghe_w_fWc3bfEsQkNjFenHZL6g,2783
9
+ orangebeard_pytest-0.1.0.dist-info/licenses/LICENSE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174
10
+ orangebeard_pytest-0.1.0.dist-info/METADATA,sha256=DJqr7pJU3szrrrjD-5Dv0yRb5qu846J3nG6scCm7K3Y,6760
11
+ orangebeard_pytest-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
12
+ orangebeard_pytest-0.1.0.dist-info/entry_points.txt,sha256=AZ3mE8mbIBsWqIv25LMOighI84O7RHMLpn9wt9KxQ6w,51
13
+ orangebeard_pytest-0.1.0.dist-info/top_level.txt,sha256=WuTaDTTJiYUzeLx0p0flpwcvkY0mjJg3FhfcmdvvvY0,19
14
+ orangebeard_pytest-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [pytest11]
2
+ orangebeard = orangebeard_pytest.plugin
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1 @@
1
+ orangebeard_pytest