| Total Complexity | 4 |
| Total Lines | 24 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 |