~johnleach/duplicity/1315437-swift-container-create

« back to all changes in this revision

Viewing changes to testing/run-tests-ve

  • Committer: Kenneth Loafman
  • Date: 2014-04-20 15:32:17 UTC
  • mfrom: (977.1.8 test-reorg)
  • Revision ID: kenneth@loafman.com-20140420153217-n4jt28oo4q7d6bzu
# Merged in lp:~mterry/duplicity/more-test-reorg
  - Here's another test reorganization / modernization branch. It does the
    following things:
    - Drop duplicity/misc.py. It is confusing to have both misc.py and util.py,
      and most of the code in misc.py was no longer used. I moved the one
      function that was still used into util.py.
    - Consolidated the various ways to run tests into just one. I made tox runs
      go through ./setup.py test, rather than nosetests. And I made the
      ./testing/run-tests scripts just call tox. Now we no longer need nosetests
      as a test dependency (although you can still use it if you want).
    - Added two more code quality automated tests: a pep8 one and a pylint one.
      I disabled almost all checks in each program that gave a warning. These
      tests just establish a baseline for future improvement.
    - Moved the test helper code into TestCase subclasses that all tests can
      use. And used more code sharing and setUp/tearDown cleverness to remove
      duplicated code.
    - Reorganized the tests in ./testing/tests into ./testing/functional and
      ./testing/unit -- for whether they drive duplicity as a subprocess or
      whether they import and test code directly. Each dir can have specialized
      TestCase subclasses now.
    - Renamed the files in ./testing/unit to more clearly indicate which file
      in ./duplicity they are unit testing.
    - Added some helper methods for tests to set environment and globals.*
      parameters more safely (i.e. without affecting other tests) by
      automatically cleaning up any such changes during test tearDown.
    - Removed test_unicode.py, since it is kind of dumb. It used to be more
      useful, but now with py2.6, we are just testing that one line of code
      in it is actually there.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
# along with duplicity; if not, write to the Free Software Foundation,
21
21
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
22
 
23
 
# Go to directory housing this script
24
 
cd $(dirname $0)
25
 
 
26
 
THISDIR=$(pwd)
27
 
export PATH="$(dirname $THISDIR)/bin:$PATH"
28
 
 
29
 
TOP_TESTS=$*
30
 
if [ -z "$TOP_TESTS" ]; then
31
 
      TOP_TESTS="all"
32
 
fi
33
 
 
34
 
if [ "$TOP_TESTS" = "all" ]; then
35
 
      TOP_TESTS="tests" # don't include manual tests unless they were asked for
36
 
fi
37
 
 
38
 
# Expand arguments if directories
39
 
TESTS=
40
 
for t in $TOP_TESTS; do
41
 
      if [ -d "$t" ]; then
42
 
        TESTS="$TESTS $(ls $t/*.py)"
43
 
      else
44
 
        TESTS="$TESTS $t"
45
 
      fi
46
 
done
47
 
 
48
 
# run against all supported python versions
49
 
for v in 2.6 2.7; do
50
 
    ve=~/virtual$v
51
 
    if [ $? == 1 ]; then
52
 
        echo "virtual$v not found on system"
53
 
        continue
54
 
    fi
55
 
    source $ve/bin/activate
56
 
 
57
 
    echo "========== Compiling librsync for virtual$v =========="
58
 
    pushd ../duplicity
59
 
    python ./compilec.py
60
 
    popd
61
 
 
62
 
    for t in $TESTS; do
63
 
        echo "========== Running $t for virtual$v =========="
64
 
        pushd .
65
 
        if ! python -u $t -v 2>&1; then
66
 
          echo "Test failed"
67
 
          exit 1
68
 
        fi
69
 
        popd
70
 
        echo "========== Finished $t for virtual$v =========="
71
 
        echo
72
 
        echo
73
 
    done
74
 
 
75
 
    deactivate
76
 
done
 
23
cd $(dirname $(dirname $0))
 
24
tox