d191cff15e3e041446eb22d38b8d879179d61bcc
- Author
- Michael Aquilina <michaelaquilina@gmail.com>
- Committer
- Michael Aquilina <michaelaquilina@gmail.com>
- Date
Message
Add tests for mkvenv
Diff
1diff --git a/tests/test_mkvenv.zunit b/tests/test_mkvenv.zunit
2new file mode 100644
3index 0000000000000000000000000000000000000000..3e3beb25e2d73d0f6694a37a26f32140fbb1c43e
4--- /dev/null
5+++ b/tests/test_mkvenv.zunit
6@@ -0,0 +1,40 @@
7+#!/usr/bin/env zunit
8+
9+@setup {
10+ source =virtualenvwrapper.sh
11+
12+ export DISABLE_AUTOSWITCH_VENV="1"
13+ load "../autoswitch_virtualenv.plugin.zsh"
14+ TARGET="$(mktemp -d)"
15+ cd "$TARGET"
16+}
17+
18+@teardown {
19+ rm -rf "$TARGET"
20+}
21+
22+@test 'mkvenv - does not create .venv if one exists' {
23+ touch .venv
24+
25+ run mkvenv
26+
27+ assert $status equals 0
28+ assert "$output" same_as ".venv file already exists. If this is a mistake use the rmvenv command"
29+}
30+
31+
32+@test 'mkvenv - creates .venv' {
33+ mkdir myproject
34+ cd myproject
35+
36+ run mkvenv
37+
38+ assert $status equals 0
39+ assert "$output" contains "New python executable"
40+ assert "$TARGET/myproject/.venv" exists
41+
42+ run cat "$TARGET/myproject/.venv"
43+
44+ assert $status equals 0
45+ assert "$output" same_as "myproject"
46+}