-
Notifications
You must be signed in to change notification settings - Fork 2
/
test_ww
executable file
·53 lines (38 loc) · 1.24 KB
/
test_ww
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
# load test tools
. ./testing/test_tools
test_can_activate_workspace() {
# create and activate workspace 'ws1'
$test_dir/ww -c ws1
source ./ww ws1
# check that the correct workspace was activated
assert_equal $WW_CURRENT_WORKSPACE ws1
assert_equal $CONDA_ENVS_PATH $test_dir/temp-ww-workdir/ws1/envs
}
test_can_activate_current() {
$test_dir/ww -c ws2
cd $WW_DEFAULT_PATH/ws2/Projects
local cwd_before=$(pwd)
source $test_dir/ww .
# check that the current work dir was not changed
local current_dir=$(pwd)
assert_equal $current_dir $cwd_before
# check that the correct workspace was activated
assert_equal $WW_CURRENT_WORKSPACE ws2
assert_equal $CONDA_ENVS_PATH $test_dir/temp-ww-workdir/ws2/envs
}
test_ww_activate_script_is_called() {
$test_dir/ww -c ws1
echo "export TEMP_TEST_VAR=1" >> $WW_DEFAULT_PATH/ws1/ww_activate.sh
source ./ww ws1
# check that the correct workspace was activated
assert_equal $WW_CURRENT_WORKSPACE ws1
assert_equal $TEMP_TEST_VAR 1
}
echo "Testing file test_ww"
echo ""
test "test_can_activate_workspace"
test "test_can_activate_current"
test "test_ww_activate_script_is_called"
echo ""
printGreen "Success"