-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
conftest.py
43 lines (32 loc) · 1.03 KB
/
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
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""
Configuration file for Pytest
"""
import os
import os.path as osp
import shutil
import pytest
# To activate/deactivate certain things for pytest's only
os.environ['SPYDER_PYTEST'] = 'True'
# Remove temp conf_dir before starting the tests
from spyder.config.base import get_conf_path
conf_dir = get_conf_path()
if osp.isdir(conf_dir):
shutil.rmtree(conf_dir)
def pytest_addoption(parser):
"""Add option to run slow tests."""
parser.addoption("--run-slow", action="store_true",
default=False, help="Run slow tests")
def pytest_collection_modifyitems(config, items):
"""Skip tests with the slow marker"""
if config.getoption("--run-slow"):
# --run-slow given in cli: do not skip slow tests
return
skip_slow = pytest.mark.skip(reason="need --run-slow option to run")
for item in items:
if "slow" in item.keywords:
item.add_marker(skip_slow)