Skip to content

Commit d1c6ba0

Browse files
committed
Test that VIRTUAL_ENV bin directory makes it into PATH in make target context
1 parent c6ef183 commit d1c6ba0

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bats
2+
3+
TEST_DIR="$(pwd)/python_venv_failure"
4+
5+
# create an arbitrary executable for the target to find
6+
function setup() {
7+
rm -rf "$TEST_DIR"
8+
mkdir -p "${TEST_DIR}/venv/bin" "${TEST_DIR}/user/.local/bin"
9+
touch "${TEST_DIR}/venv/bin/test.bat"
10+
chmod +x "${TEST_DIR}/venv/bin/test.bat"
11+
}
12+
13+
@test "python/venv: failure" {
14+
# If the executable is not found, the target will exit 2
15+
run make guard/program/test.bat
16+
[ "$status" -eq 2 ]
17+
[[ "$output" == *"No rule to make target 'test.bat/install"* ]]
18+
}
19+
20+
function teardown() {
21+
rm -rf "$TEST_DIR"
22+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bats
2+
3+
TEST_DIR="$(pwd)/python_venv_success"
4+
5+
# create an arbitrary executable for the target to find
6+
function setup() {
7+
rm -rf "$TEST_DIR"
8+
mkdir -p "${TEST_DIR}/venv/bin" "${TEST_DIR}/user/.local/bin"
9+
touch "${TEST_DIR}/venv/bin/test.bat"
10+
chmod +x "${TEST_DIR}/venv/bin/test.bat"
11+
export VIRTUAL_ENV="${TEST_DIR}/venv"
12+
export PYTHONUSERBASE="${TEST_DIR}/user/.local"
13+
}
14+
15+
@test "python/venv: success" {
16+
# If the executable is found, the target will exit 0
17+
run make guard/program/test.bat
18+
[ "$status" -eq 0 ]
19+
}
20+
21+
function teardown() {
22+
rm -rf "$TEST_DIR"
23+
}

0 commit comments

Comments
 (0)