Skip to content

Commit

Permalink
tell travis to run the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kennethreitz committed Jan 25, 2017
1 parent acd9347 commit cd52da6
Show file tree
Hide file tree
Showing 8 changed files with 1,324 additions and 4 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
sudo: false
script: exit 0
language: bash
sudo: required
services:
- docker
install: docker pull heroku/cedar:14
script: make test
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# These targets are not files
.PHONY: tests

tests:
./bin/test
test: test-cedar-14

test-cedar-14:
@echo "Running tests in docker (cedar-14)..."
@docker run -v $(shell pwd):/buildpack:ro --rm -it -e "STACK=cedar-14" heroku/cedar:14 bash -c 'cp -r /buildpack /buildpack_test; cd /buildpack_test/; test/run;'
@echo ""

tools:
git clone https://github.com/kennethreitz/pip-pop.git
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/psycopg2/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
psycopg2
1 change: 1 addition & 0 deletions test/fixtures/requirements-standard/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests
Empty file added test/fixtures/setup-py/setup.py
Empty file.
72 changes: 72 additions & 0 deletions test/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash
# See README.md for info on running these tests.

testStandardRequirements() {
compile "requirements-standard"
assertCaptured "requests"
assertCapturedSuccess
}

testPsycopg2() {
compile "psycopg2"
assertCaptured "psycopg2"
assertCapturedSuccess
}

pushd $(dirname 0) >/dev/null
popd >/dev/null

source $(pwd)/test/utils

mktmpdir() {
dir=$(mktemp -t testXXXXX)
rm -rf $dir
mkdir $dir
echo $dir
}

detect() {
capture $(pwd)/bin/detect $(pwd)/test/fixtures/$1
}

compile_dir=""

default_process_types_cleanup() {
file="/tmp/default_process_types"
if [ -f "$file" ]; then
rm "$file"
fi
}

compile() {
default_process_types_cleanup
bp_dir=$(mktmpdir)
compile_dir=$(mktmpdir)
cp -a $(pwd)/* ${bp_dir}
cp -a ${bp_dir}/test/fixtures/$1/. ${compile_dir}
capture ${bp_dir}/bin/compile ${compile_dir} ${2:-$(mktmpdir)} $3
}

compileDir() {
default_process_types_cleanup

local bp_dir=$(mktmpdir)
local compile_dir=${1:-$(mktmpdir)}
local cache_dir=${2:-$(mktmpdir)}
local env_dir=$3

cp -a $(pwd)/* ${bp_dir}
capture ${bp_dir}/bin/compile ${compile_dir} ${cache_dir} ${env_dir}
}

release() {
bp_dir=$(mktmpdir)
cp -a $(pwd)/* ${bp_dir}
capture ${bp_dir}/bin/release ${bp_dir}/test/fixtures/$1
}

assertFile() {
assertEquals "$1" "$(cat ${compile_dir}/$2)"
}

source $(pwd)/test/shunit2
Loading

0 comments on commit cd52da6

Please sign in to comment.