Merge pull request #320 from harlowja/master
Begin to make more 'OS' compliant/like.
This commit is contained in:
commit
aea7aeec61
@ -30,9 +30,9 @@ PASSWORD_PROMPT = 'the database user'
|
||||
|
||||
|
||||
def get_shared_passwords(component):
|
||||
mp = {}
|
||||
mp['pw'] = component.get_password('sql')
|
||||
return mp
|
||||
return {
|
||||
'pw': component.get_password('sql'),
|
||||
}
|
||||
|
||||
|
||||
def drop_db(distro, dbtype, user, pw, dbname, **kwargs):
|
||||
|
15
anvil/tests/__init__.py
Normal file
15
anvil/tests/__init__.py
Normal file
@ -0,0 +1,15 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
12
anvil/tests/test_utils.py
Normal file
12
anvil/tests/test_utils.py
Normal file
@ -0,0 +1,12 @@
|
||||
import unittest
|
||||
|
||||
from anvil import utils
|
||||
|
||||
|
||||
class TestUtils(unittest.TestCase):
|
||||
def test_expand(self):
|
||||
text = "blah $v"
|
||||
text = utils.expand_template(text, {
|
||||
'v': 'blah',
|
||||
})
|
||||
self.assertEquals(text, "blah blah")
|
@ -1,16 +1,38 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -u
|
||||
# set -x
|
||||
|
||||
function find_src {
|
||||
NOSEARGS=
|
||||
JUST_PEP8=0
|
||||
|
||||
function usage {
|
||||
echo "Usage: $0 [OPTION]..."
|
||||
echo "Run anvils test suite."
|
||||
echo ""
|
||||
echo " -p, --pep8 Just run pep8"
|
||||
echo " -h, --help Print this usage message"
|
||||
echo ""
|
||||
exit
|
||||
}
|
||||
|
||||
function process_option {
|
||||
case "$1" in
|
||||
-h|--help) usage;;
|
||||
-p|--pep8) let JUST_PEP8=1;;
|
||||
-c|--coverage) NOSEARGS="$NOSEARGS --with-coverage --cover-package=anvil";;
|
||||
*) NOSEARGS="$NOSEARGS $1"
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
function find_code {
|
||||
files=`find anvil -type f | grep "py\$"`
|
||||
echo $files
|
||||
}
|
||||
|
||||
function run_pep8 {
|
||||
echo "Running pep8 ..."
|
||||
files=$(find_src)
|
||||
files=$(find_code)
|
||||
ignores="E202,E501"
|
||||
output_filename="pep8.log"
|
||||
opts="--ignore=$ignores --repeat"
|
||||
@ -24,7 +46,7 @@ function run_pep8 {
|
||||
function run_pylint {
|
||||
echo "Running pylint ..."
|
||||
opts="--rcfile=pylintrc --output-format=parseable"
|
||||
files=$(find_src)
|
||||
files=$(find_code)
|
||||
output_filename="pylint.log"
|
||||
pylint ${opts} ${files} 2>&1 > $output_filename
|
||||
if [ "$?" -eq "1" ]; then
|
||||
@ -48,6 +70,13 @@ function run_pylint {
|
||||
echo "Check '$output_filename' for a full report."
|
||||
}
|
||||
|
||||
function run_tests {
|
||||
echo "Running tests ..."
|
||||
# Cleanup *.pyc
|
||||
find . -type f -name "*.pyc" -delete
|
||||
$NOSETESTS
|
||||
}
|
||||
|
||||
function validate_yaml {
|
||||
echo "Validating YAML files..."
|
||||
for f in `find conf/ -name *.yaml -type f`; do
|
||||
@ -59,7 +88,18 @@ function validate_yaml {
|
||||
done
|
||||
}
|
||||
|
||||
for arg in "$@"; do
|
||||
process_option $arg
|
||||
done
|
||||
|
||||
export NOSETESTS="nosetests $NOSEARGS"
|
||||
|
||||
if [ $JUST_PEP8 -eq 1 ]; then
|
||||
run_pep8
|
||||
exit 0
|
||||
fi
|
||||
|
||||
run_tests
|
||||
run_pep8
|
||||
run_pylint
|
||||
validate_yaml
|
||||
|
0
tools/img-uploader.py
Normal file → Executable file
0
tools/img-uploader.py
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user