Skip to content

Commit

Permalink
Added capability for run_tests to return a success/failure exit codes
Browse files Browse the repository at this point in the history
  • Loading branch information
Dataliberate committed Aug 2, 2019
1 parent 319c80f commit dad975e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
17 changes: 17 additions & 0 deletions scripts/buildreleasefiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,22 @@ then
fi

echo
echo "Running Unit Tests... "
./scripts/run_tests.py
if [ $? -eq 0 ]
then
echo
echo " Unit Tests ran succesfully"
else
echo
echo " Unit Tests failed!!"
echo "$RES"
echo
echo "Manually run ./scripts/run_tests.py for more details"
echo "Aborting..."
exit 1
fi

echo -n "Preparing by running buildTermConfig.sh... "
./scripts/buildTermConfig.sh
echo " Prepared."
Expand Down Expand Up @@ -129,6 +145,7 @@ rm -f $DIR/schemaorg.owl 2>&1 > /dev/null
echo " cleaned."
sleep 2


echo -n "Copying schema.rdfa and README.md into release directory... "
cp ./data/schema.rdfa $DIR
cp ./README.md $DIR
Expand Down
8 changes: 6 additions & 2 deletions scripts/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,12 @@ def main(test_path, args):
else:
suite = unittest.loader.TestLoader().discover(test_path, pattern="test*.py")

unittest.TextTestRunner(verbosity=2).run(suite)

res = unittest.TextTestRunner(verbosity=2).run(suite)

count = len(res.failures) + len(res.errors)
sys.exit(count)


if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Configurable testing of schema.org.')
parser.add_argument('--skipbasics', action='store_true', help='Skip basic tests.')
Expand Down

0 comments on commit dad975e

Please sign in to comment.