Skip to content

Commit

Permalink
fix documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonapich committed Oct 27, 2023
1 parent b0bbea7 commit 2ba9717
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 19 deletions.
20 changes: 10 additions & 10 deletions coveo-ref/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tool that can extract the string representation of a python objet. This is what

```python
from unittest.mock import patch, MagicMock
from coveo_testing.mocks import ref
from coveo_ref import ref
from mymodule.clients import APIClient

@patch(*ref(APIClient._do_request))
Expand Down Expand Up @@ -64,7 +64,7 @@ But with `ref`, you specify the context separately:

```python
from unittest.mock import patch, MagicMock
from coveo_testing.mocks import ref
from coveo_ref import ref
from mymodule.clients import get_api_client
from mymodule.tasks import process

Expand Down Expand Up @@ -100,7 +100,7 @@ The test:

```python
from unittest.mock import patch, MagicMock
from coveo_testing.mocks import ref
from coveo_ref import ref
from mymodule.clients import get_api_client
from mymodule.tasks import process

Expand Down Expand Up @@ -132,7 +132,7 @@ can unpack to `patch.object()`:

```python
from unittest.mock import patch
from coveo_testing.mocks import ref
from coveo_ref import ref
from mymodule.clients import APIClient

def test() -> None:
Expand All @@ -155,7 +155,7 @@ For instance, consider this test:
```python
from http.client import HTTPResponse
from unittest.mock import patch, MagicMock
from coveo_testing.mocks import ref
from coveo_ref import ref

from mymodule.tasks import process

Expand Down Expand Up @@ -226,7 +226,7 @@ So you _know_ this works globally, because no one will (should?) import the priv

```python
from unittest.mock import patch, MagicMock
from coveo_testing.mocks import ref
from coveo_ref import ref

from mymodule.tasks import process
from mymodule.clients import _get_api_client
Expand Down Expand Up @@ -259,7 +259,7 @@ The test, showing 3 different methods that work:

```python
from unittest.mock import patch, MagicMock
from coveo_testing.mocks import ref
from coveo_ref import ref

from mymodule.clients import get_api_client
from mymodule.tasks import process
Expand Down Expand Up @@ -296,7 +296,7 @@ Sometimes, the test file _is_ the context. When that happens, just pass `__name_

```python
from unittest.mock import patch
from coveo_testing.mocks import ref
from coveo_ref import ref
from mymodule.clients import get_api_client, APIClient

def _prepare_test() -> APIClient:
Expand Down Expand Up @@ -377,7 +377,7 @@ class MyClass:

```python
from unittest.mock import PropertyMock, patch, MagicMock
from coveo_testing.mocks import ref
from coveo_ref import ref

from mymodule import MyClass

Expand Down Expand Up @@ -406,7 +406,7 @@ For this particular scenario, the workaround is to provide the instance as the c

```python
from unittest.mock import patch
from coveo_testing.mocks import ref
from coveo_ref import ref


class MyClass:
Expand Down
2 changes: 1 addition & 1 deletion coveo-ref/coveo_ref/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ def ref(
refactorable mocks.
The idea is to provide the thing to mock as the target, and sometimes, the thing that is being tested
as the context. Refer to `coveo-testing`'s readme to better understand when a context is necessary.
as the context. Refer to `coveo-ref`'s readme to better understand when a context is necessary.
For example, pass the `HTTPResponse` class as the target and the `my_module.function_to_test` function
as the context, so that `my_module.HTTPResponse` becomes mocked (and not httplib.client.HTTPResponse).
Expand Down
8 changes: 0 additions & 8 deletions coveo-ref/tests_coveo_ref/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1 @@
"""pytest bootstrap"""

from _pytest.config import Config
from coveo_testing.markers import register_markers


def pytest_configure(config: Config) -> None:
"""This pytest hook is ran once, before collecting tests."""
register_markers(config)

0 comments on commit 2ba9717

Please sign in to comment.