Skip to content

Commit efb17bb

Browse files
committed
add test to ensure templates are applied correctly
1 parent 3c79948 commit efb17bb

File tree

6 files changed

+664
-4
lines changed

6 files changed

+664
-4
lines changed

.hgignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ tests/catch_output
1313
tests/testpackage/build
1414
tests/testpackage/dist
1515
tests/testpackage/testpackage.egg-info
16+
tests/testtemplate/build
17+
tests/testtemplate/dist
18+
tests/testtemplate/testtemplate.egg-info
1619
trace.txt
1720
virtualenvwrapper.egg-info
1821
virtualenvwrapper/docs

tests/test_project_templates.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export WORKON_HOME="$(echo ${TMPDIR:-/tmp}/WORKON_HOME | sed 's|//|/|g')"
88
export PROJECT_HOME="$(echo ${TMPDIR:-/tmp}/PROJECT_HOME | sed 's|//|/|g')"
99

1010
oneTimeSetUp() {
11+
(cd "$test_dir/testtemplate" && python setup.py install)
1112
rm -rf "$WORKON_HOME"
1213
mkdir -p "$WORKON_HOME"
1314
rm -rf "$PROJECT_HOME"
@@ -26,11 +27,14 @@ setUp () {
2627
}
2728

2829
test_list_templates () {
29-
mkproject myproject >/dev/null 2>&1
30-
output=`mkproject myproject 2>&1`
31-
assertTrue "Did not see expected message" "echo $output | grep 'already exists'"
32-
deactivate
30+
output=$(mkproject -h 2>&1)
31+
assertTrue "Did not find test template in \"$output\"" "echo \"$output\" | grep -q test"
3332
}
3433

34+
test_apply_template () {
35+
mkproject -t test proj1
36+
assertTrue "Test file not created" "[ -f TEST_FILE ]"
37+
assertTrue "project name not found" "grep -q proj1 TEST_FILE"
38+
}
3539

3640
. "$test_dir/shunit2"

0 commit comments

Comments
 (0)