1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 02:20:03 +08:00
SpaceVim/bundle/python-imports.vim/test/conftest.py

35 lines
658 B
Python
Vendored

import os
import sys
import pytest
source_path = os.path.join(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'pythonx')
sys.path.append(source_path)
class VimStub(object):
def __init__(self):
self.executed_commands = []
def command(self, cmd):
self.executed_commands.append(cmd)
try:
import vim
except ImportError:
sys.modules['vim'] = VimStub()
else: # pragma: nocover
del vim
@pytest.fixture(autouse=True)
def vim(monkeypatch):
import python_imports as mod
stub = VimStub()
monkeypatch.setitem(sys.modules, 'vim', stub)
monkeypatch.setattr(mod, 'vim', stub)
return stub