-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
fixtures.py
41 lines (31 loc) · 869 Bytes
/
fixtures.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
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""Testing utilities to be used with pytest."""
# Standard library imports
import shutil
# Third party imports
import pytest
from spyder.config.user import UserConfig
from spyder.config.main import CONF_VERSION, DEFAULTS
@pytest.fixture
def tmpconfig(tmpdir, request):
path = str(tmpdir)
default_kwargs = {
'name': 'spyder-test',
'path': path,
'defaults': DEFAULTS,
'load': True,
'version': CONF_VERSION,
'backup': True,
'raw_mode': True,
'remove_obsolete': False,
}
conf = UserConfig(**default_kwargs)
def fin():
"""Fixture finalizer to delete the temporary CONF element."""
shutil.rmtree(path)
request.addfinalizer(fin)
return conf