From 3859ac0c9b17edd9776c5e9b42d0c13e4ee7eb42 Mon Sep 17 00:00:00 2001 From: Bailey Stoner Date: Tue, 10 Oct 2017 13:49:47 -0700 Subject: [PATCH 1/2] Use $VIRTUAL_ENV environment variable when present. --- autoload/ale/python.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/ale/python.vim b/autoload/ale/python.vim index 4f14697..d788b77 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. From 620ec32da15acaa0a395abb03dbcb47504a645fb Mon Sep 17 00:00:00 2001 From: Bailey Stoner Date: Wed, 11 Oct 2017 13:42:38 -0700 Subject: [PATCH 2/2] Add a test to ensure $VIRTUAL_ENV is respected. --- test/test_python_virtualenv.vader | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/test_python_virtualenv.vader diff --git a/test/test_python_virtualenv.vader b/test/test_python_virtualenv.vader new file mode 100644 index 0000000..b44c5fa --- /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'