forked from replicate/replicate-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconftest.py
More file actions
27 lines (20 loc) · 671 Bytes
/
Copy pathconftest.py
File metadata and controls
27 lines (20 loc) · 671 Bytes
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
import os
from unittest import mock
import pytest
@pytest.fixture(scope="session")
def mock_replicate_api_token(scope="class"):
if os.environ.get("REPLICATE_API_TOKEN", "") != "":
yield
else:
with mock.patch.dict(
os.environ,
{"REPLICATE_API_TOKEN": "test-token", "REPLICATE_POLL_INTERVAL": "0.0"},
):
yield
@pytest.fixture(scope="module")
def vcr_config():
return {"allowed_hosts": ["api.replicate.com"], "filter_headers": ["authorization"]}
@pytest.fixture(scope="module")
def vcr_cassette_dir(request):
module = request.node.fspath
return os.path.join(module.dirname, "cassettes")