# scope_profiler.pytest_plugin

*module*

Opt-in pytest integration for recording test-phase durations.

The plugin deliberately owns an independent :class:`ProfileManager`.  Tests
are free to set up and finalize the process-wide ``ProfileManager`` themselves
without corrupting the profile pytest is collecting.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/pytest_plugin.py#L1-L1)

## scope_profiler.pytest_plugin.pytest_addoption

*function*

```python
def pytest_addoption(parser) -> None
```

Register the command-line switches without enabling profiling by default.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/pytest_plugin.py#L19-L43)

## scope_profiler.pytest_plugin.pytest_runtest_call

*function*

```python
def pytest_runtest_call(item)
```

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/pytest_plugin.py#L93-L99)

## scope_profiler.pytest_plugin.pytest_runtest_setup

*function*

```python
def pytest_runtest_setup(item)
```

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/pytest_plugin.py#L84-L90)

## scope_profiler.pytest_plugin.pytest_runtest_teardown

*function*

```python
def pytest_runtest_teardown(item, nextitem)
```

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/pytest_plugin.py#L102-L108)

## scope_profiler.pytest_plugin.pytest_sessionfinish

*function*

```python
def pytest_sessionfinish(session, exitstatus) -> None
```

Publish the profile even when one or more tests failed.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/pytest_plugin.py#L111-L123)

## scope_profiler.pytest_plugin.pytest_sessionstart

*function*

```python
def pytest_sessionstart(session) -> None
```

Start one independent profiling run for this pytest invocation.

[View source](https://github.com/max-models/scope-profiler/blob/devel/src/scope_profiler/pytest_plugin.py#L58-L75)
