conftest   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 16
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 4

1 Function

Rating   Name   Duplication   Size   Complexity  
A vim() 0 13 4
1
import json
2
import os
3
4
import pytest
5
6
import pynvim
7
8
pynvim.setup_logging("test")
9
10
11
@pytest.fixture
12
def vim():
13
    child_argv = os.environ.get('NVIM_CHILD_ARGV')
14
    listen_address = os.environ.get('NVIM_LISTEN_ADDRESS')
15
    if child_argv is None and listen_address is None:
16
        child_argv = '["nvim", "-u", "NONE", "--embed", "--headless"]'
17
18
    if child_argv is not None:
19
        editor = pynvim.attach('child', argv=json.loads(child_argv))
20
    else:
21
        editor = pynvim.attach('socket', path=listen_address)
22
23
    return editor
24