forked from jaraco/cssutils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconftest.py
43 lines (30 loc) · 870 Bytes
/
conftest.py
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
33
34
35
36
37
38
39
40
41
42
43
import importlib
import pytest
import cssutils
collect_ignore = [
'cssutils/_fetchgae.py',
'tools',
]
try:
importlib.import_module('lxml.etree')
except ImportError:
collect_ignore += ['examples/style.py']
@pytest.fixture(autouse=True)
def hermetic_profiles():
"""
Ensure that tests are hermetic w.r.t. profiles.
"""
before = list(cssutils.profile.profiles)
yield
assert before == cssutils.profile.profiles
@pytest.fixture
def saved_profiles(monkeypatch):
profiles = cssutils.profiles.Profiles(log=cssutils.log)
monkeypatch.setattr(cssutils, 'profile', profiles)
@pytest.fixture(autouse=True)
def raise_exceptions():
# configure log to raise exceptions
cssutils.log.raiseExceptions = True
@pytest.fixture(autouse=True)
def restore_serializer_preference_defaults():
cssutils.ser.prefs.useDefaults()