summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-10-11 22:18:22 +0100
committerGitHub <noreply@github.com>2017-10-11 22:18:22 +0100
commitbe547a0111c67473f69dec93d59cb071322b05c5 (patch)
tree4fc3026362f6b1f488d1dc8befb79caf817cb1e4
parent70177480ba1f9968409709442fc4be4e9a69d564 (diff)
parent620ec32da15acaa0a395abb03dbcb47504a645fb (diff)
downloadale-be547a0111c67473f69dec93d59cb071322b05c5.zip
Merge pull request #990 from monokrome/master
Use $VIRTUAL_ENV environment variable when present.
-rw-r--r--autoload/ale/python.vim2
-rw-r--r--test/test_python_virtualenv.vader12
2 files changed, 13 insertions, 1 deletions
diff --git a/autoload/ale/python.vim b/autoload/ale/python.vim
index 4f14697c..d788b779 100644
--- a/autoload/ale/python.vim
+++ b/autoload/ale/python.vim
@@ -71,7 +71,7 @@ function! ale#python#FindVirtualenv(buffer) abort
endfor
endfor
- return ''
+ return $VIRTUAL_ENV
endfunction
" Run an executable check for Python scripts.
diff --git a/test/test_python_virtualenv.vader b/test/test_python_virtualenv.vader
new file mode 100644
index 00000000..b44c5fa2
--- /dev/null
+++ b/test/test_python_virtualenv.vader
@@ -0,0 +1,12 @@
+Before:
+ Save $VIRTUAL_ENV
+ let $VIRTUAL_ENV = "/opt/example/"
+
+After:
+ Restore
+
+Execute(ale#python#FindVirtualenv falls back to $VIRTUAL_ENV when no directories match):
+ AssertEqual
+ \ ale#python#FindVirtualenv(bufnr('%')),
+ \ '/opt/example/',
+ \ 'Expected VIRTUAL_ENV environment variable to be used, but it was not'