Skip to content
Browse files

moving to new testing infrastructure

  • Loading branch information...
1 parent bb73574 commit 4461ae33f7c2b04c9ff00434d5c5abcf1144bc54 @maxcountryman maxcountryman committed
Showing with 75 additions and 30 deletions.
  1. +28 −0 Makefile
  2. +43 −0 run-tests.sh
  3. +4 −30 setup.py
View
28 Makefile
@@ -0,0 +1,28 @@
+.PHONY: all test clean_coverage clean pep8 pyflakes check
+
+all:
+ @echo 'test run the unit tests'
+ @echo 'coverage generate coverage statistics'
+ @echo 'pep8 check pep8 compliance'
+ @echo 'pyflakes check for unused imports (requires pyflakes)'
+ @echo 'check make sure you are ready to commit'
+ @echo 'clean cleanup the source tree'
+
+test: clean_coverage
+ @echo 'Running all tests...'
+ @VERBOSE=1 PATH=${PATH} ./run-tests.sh
+
+clean_coverage:
+ @rm -f .coverage
+
+pep8:
+ @echo 'Checking pep8 compliance...'
+ @pep8 rauth tests
+
+pyflakes:
+ @echo 'Running pyflakes...'
+ @pyflakes rauth tests
+
+check: pep8 pyflakes test
+ @grep ^TOTAL tests_output/test.log | grep 100% >/dev/null || \
+ { echo 'Unit tests coverage is incomplete.'; exit 1; }
View
43 run-tests.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+OUTPUT_PATH=$(pwd)/tests_output
+
+function log() {
+ echo "$@" | tee -a $OUTPUT_PATH/test.log
+}
+
+rm -rf $OUTPUT_PATH
+mkdir -p $OUTPUT_PATH
+
+NOSETEST_OPTIONS="-d"
+
+if [ -n "$VERBOSE" ]; then
+ NOSETEST_OPTIONS="$NOSETEST_OPTIONS --verbose"
+fi
+
+if [ -z "$NOCOLOR" ]; then
+ NOSETEST_OPTIONS="$NOSETEST_OPTIONS --with-yanc --yanc-color=on"
+fi
+
+if [ -n "$OPTIONS" ]; then
+ NOSETEST_OPTIONS="$NOSETEST_OPTIONS $OPTIONS"
+fi
+
+if [ -n "$TESTS" ]; then
+ NOSETEST_OPTIONS="$NOSETEST_OPTIONS $TESTS"
+else
+ NOSETEST_OPTIONS="$NOSETEST_OPTIONS --with-coverage --cover-package=rauth"
+fi
+
+log "Running tests..."
+nosetests $NOSETEST_OPTIONS 2>&1 | tee -a $OUTPUT_PATH/test.log
+ret=${PIPESTATUS[0]}
+
+echo
+
+case "$ret" in
+ 0) log -e "SUCCESS" ;;
+ *) log -e "FAILURE" ;;
+esac
+
+exit $ret
View
34 setup.py
@@ -1,46 +1,20 @@
import os
import sys
-import rauth
+from rauth import __version__
from setuptools import setup, find_packages
if sys.argv[-1] == 'test':
- abspath = os.path.abspath(__file__)
- dname = os.path.dirname(abspath)
- os.chdir(dname)
-
- pyflakes = 'pyflakes rauth tests'
- pep8 = 'pep8 rauth tests'
- nosetests = ('nosetests -v --with-coverage --cover-package=rauth')
- coverage = ('grep ^TOTAL test.log | grep 100% >/dev/null ||'
- '{ echo \'\n\033[1m\033[91mFAILURE\033[0m: '
- 'Test coverage incomplete.\'&& exit 1; }')
- tests = ('grep OK test.log >/dev/null || exit 1')
-
- try:
- import yanc
- nosetests += ' --with-yanc --yanc-color=on'
- except ImportError:
- pass
-
- nosetests += ' 2>&1 | tee -a test.log'
-
- status = os.system(' && '.join([pyflakes, pep8, nosetests, coverage]))
+ status = os.system('make check')
status >>= 8
-
- if os.path.isfile('test.log'):
- if status == 0:
- status = os.system(tests)
- os.system('rm test.log')
-
sys.exit(status)
-install_requires = ['requests>=1.0.0']
+install_requires = ['requests>=1.1.0']
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
install_requires.append('unittest2>=0.5.1')
setup(name='rauth',
- version=rauth.__version__,
+ version=__version__,
description='A Python library for OAuth 1.0/a, 2.0, and Ofly.',
long_description=open('README.markdown').read(),
author='Max Countryman',

0 comments on commit 4461ae3

Please sign in to comment.
Something went wrong with that request. Please try again.