From dd216f57bcb45fcbea37d71f15421f970c0ae7de Mon Sep 17 00:00:00 2001 From: Timur Nurlygayanov Date: Mon, 1 Apr 2013 11:48:16 +0400 Subject: [PATCH] Add initial files for unit tests. --- conductor/run_tests.sh | 49 +++++++++++++++++++ conductor/tests/__init__.py | 0 conductor/tests/conductor/__init__.py | 0 conductor/tests/conductor/test_methods.py | 0 .../tests/conductor/test_with_fake_service.py | 0 5 files changed, 49 insertions(+) create mode 100755 conductor/run_tests.sh create mode 100644 conductor/tests/__init__.py create mode 100644 conductor/tests/conductor/__init__.py create mode 100644 conductor/tests/conductor/test_methods.py create mode 100644 conductor/tests/conductor/test_with_fake_service.py diff --git a/conductor/run_tests.sh b/conductor/run_tests.sh new file mode 100755 index 0000000..ba2c9e0 --- /dev/null +++ b/conductor/run_tests.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +function usage { + echo "Usage: $0 [OPTION]..." + echo "Run python-portasclient's test suite(s)" + echo "" + echo " -p, --pep8 Just run pep8" + echo " -h, --help Print this usage message" + echo "" + echo "This script is deprecated and currently retained for compatibility." + echo 'You can run the full test suite for multiple environments by running "tox".' + echo 'You can run tests for only python 2.7 by running "tox -e py27", or run only' + echo 'the pep8 tests with "tox -e pep8".' + exit +} + +command -v tox > /dev/null 2>&1 +if [ $? -ne 0 ]; then + echo 'This script requires "tox" to run.' + echo 'You can install it with "pip install tox".' + exit 1; +fi + +just_pep8=0 + +function process_option { + case "$1" in + -h|--help) usage;; + -p|--pep8) let just_pep8=1;; + esac +} + +for arg in "$@"; do + process_option $arg +done + +if [ $just_pep8 -eq 1 ]; then + tox -e pep8 + exit +fi + +tox -e py27 $toxargs 2>&1 | tee run_tests.err.log || exit +if [ ${PIPESTATUS[0]} -ne 0 ]; then + exit ${PIPESTATUS[0]} +fi + +if [ -z "$toxargs" ]; then + tox -e pep8 +fi diff --git a/conductor/tests/__init__.py b/conductor/tests/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/conductor/tests/conductor/__init__.py b/conductor/tests/conductor/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/conductor/tests/conductor/test_methods.py b/conductor/tests/conductor/test_methods.py new file mode 100644 index 0000000..e69de29 diff --git a/conductor/tests/conductor/test_with_fake_service.py b/conductor/tests/conductor/test_with_fake_service.py new file mode 100644 index 0000000..e69de29