File: pyvenv-virtualenv-list-test.el

package info (click to toggle)
pyvenv-el 1.21%2Bgit20211014.31ea715-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 200 kB
  • sloc: lisp: 718; makefile: 30; sh: 12
file content (21 lines) | stat: -rw-r--r-- 1,074 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
(ert-deftest pyvenv-virtualenv-list ()
  "Ensure all correct virtualenvs are returned"
  (with-temp-dir workon-home
    (let ((process-environment process-environment))
      (setq process-environment
            (cons (format "WORKON_HOME=%s/does-not-exist" workon-home)
                  process-environment))
      (should-error (pyvenv-virtualenv-list))
      (should (null (pyvenv-virtualenv-list t)))
      (setq process-environment
            (cons (format "WORKON_HOME=%s" workon-home)
                  (cdr process-environment)))
      (should (equal (pyvenv-virtualenv-list) nil))
      (make-directory (format "%s/no-venv-dir" workon-home))
      (write-region "" nil (format "%s/no-venv-file" workon-home))
      (dolist (name '("venv-a" "venv-B" "venv-C"))
        (make-directory (format "%s/%s" workon-home name))
        (make-directory (format "%s/%s/bin" workon-home name))
        (write-region "" nil (format "%s/%s/bin/activate" workon-home name)))
      (should (equal (pyvenv-virtualenv-list)
                     '("venv-a" "venv-B" "venv-C"))))))