Skip to content

Commit 66d2b49

Browse files
authored
Merge pull request #61 from scaleapi/da/export_autotags
Simplify error handling + Export Autotags
2 parents f5371ab + b1e2ac6 commit 66d2b49

File tree

7 files changed

+134
-100
lines changed

7 files changed

+134
-100
lines changed

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,9 @@ pip3 install poetry
162162
poetry install
163163
```
164164

165-
Please install the pre-commit hooks by running the following commands:
165+
Please install the pre-commit hooks by running the following command:
166166
```python
167-
pip install pre-commit
168-
pre-commit install
167+
poetry run pre-commit install
169168
```
170169

171170
**Best practices for testing:**

conftest.py

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,36 +29,8 @@
2929

3030

3131
@pytest.fixture(scope="session")
32-
def monkeypatch_session(request):
33-
"""This workaround is needed to allow monkeypatching in session-scoped fixtures.
34-
35-
See https://github.com/pytest-dev/pytest/issues/363
36-
"""
37-
from _pytest.monkeypatch import MonkeyPatch
38-
39-
mpatch = MonkeyPatch()
40-
yield mpatch
41-
mpatch.undo()
42-
43-
44-
@pytest.fixture(scope="session")
45-
def CLIENT(monkeypatch_session):
32+
def CLIENT():
4633
client = nucleus.NucleusClient(API_KEY)
47-
48-
# Change _make_request to raise AsssertionErrors when the
49-
# HTTP status code is not successful, so that tests fail if
50-
# the request was unsuccessful.
51-
def _make_request_patch(
52-
payload: dict, route: str, requests_command=requests.post
53-
) -> dict:
54-
response = client._make_request_raw(payload, route, requests_command)
55-
assert response.status_code in SUCCESS_STATUS_CODES, (
56-
f"HTTP response had status code: {response.status_code}. "
57-
f"Full JSON: {response.json()}"
58-
)
59-
return response.json()
60-
61-
monkeypatch_session.setattr(client, "_make_request", _make_request_patch)
6234
return client
6335

6436

0 commit comments

Comments
 (0)