forked from tinify/tinify-python
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconftest.py
More file actions
32 lines (23 loc) · 655 Bytes
/
conftest.py
File metadata and controls
32 lines (23 loc) · 655 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
28
29
30
31
32
import pytest
import os
import tinify
import requests_mock
@pytest.fixture
def dummy_file():
return os.path.join(os.path.dirname(__file__), "examples", "dummy.png")
@pytest.fixture(autouse=True)
def reset_tinify():
original_key = tinify.key
original_app_identifier = tinify.app_identifier
original_proxy = tinify.proxy
tinify.key = None
tinify.app_identifier = None
tinify.proxy = None
yield
tinify.key = original_key
tinify.app_identifier = original_app_identifier
tinify.proxy = original_proxy
@pytest.fixture
def mock_requests():
with requests_mock.Mocker(real_http=False) as m:
yield m