Skip to content

Commit 69d6d0f

Browse files
committed
allow nosetests without env setup
1 parent cc24cd2 commit 69d6d0f

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ install:
3434
- pip install .
3535
script:
3636
- if [ $CI_TARGET = tests ]; then
37-
NVIM_CHILD_ARGV='["nvim", "-u", "NONE", "--embed"]' nosetests;
37+
nosetests;
3838
else
3939
flake8 neovim;
4040
fi

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,16 @@ to use it for the plugin host.
118118
To run the tests execute
119119

120120
```sh
121-
NVIM_CHILD_ARGV='["nvim", "-u", "NONE", "--embed"]' nosetests
121+
nosetests
122+
```
123+
124+
This will run the tests in an embedded instance of nvim.
125+
If you want to test a different version than `nvim` in `$PATH` use
126+
```sh
127+
NVIM_CHILD_ARGV='["/path/to/nvim", "-u", "NONE", "--embed"]' nosetests
122128
```
123129

124-
Alternatively, if you want to see the state of nvim, you could
130+
Alternatively, if you want to see the state of nvim, you could use
125131

126132
```sh
127133
export NVIM_LISTEN_ADDRESS=/tmp/nvimtest

test/test_common.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@
88

99
neovim.setup_logging()
1010

11-
if 'NVIM_CHILD_ARGV' in os.environ:
12-
vim = neovim.attach('child', argv=json.loads(os.environ['NVIM_CHILD_ARGV']))
11+
child_argv = os.environ.get('NVIM_CHILD_ARGV')
12+
listen_address = os.environ.get('NVIM_LISTEN_ADDRESS')
13+
if child_argv is None and listen_address is None:
14+
child_argv = '["nvim", "-u", "NONE", "--embed"]'
15+
16+
if child_argv is not None:
17+
vim = neovim.attach('child', argv=json.loads(child_argv))
1318
else:
14-
vim = neovim.attach('socket', path=os.environ['NVIM_LISTEN_ADDRESS'])
19+
vim = neovim.attach('socket', path=listen_address)
1520

1621
if sys.version_info >= (3, 0):
1722
# For Python3 we decode binary strings as Unicode for compatibility

0 commit comments

Comments
 (0)