<commit_before>#!/bin/bash
#This script runs all the existing unit tests for the users, schools and stories apps.
# You will need to create a "test" db by cloning the main databasee (eg. createdb -T klpwww_ver4 test_klpwww_ver4 )
#The name of the "test" DB should be entered in the dubdubdub/local_test_settings.py file. Please see those files for further instructions. 


# Create the test database from the dev DB

#Read the local settings file and get the name of the DB. Used a python script to read the DB name from DJango settings.
# Maybe a better way of doing this?

# Call script to create test database

testDB=''
source createTestDb.sh
exit_status=$?
if [ $exit_status -ne 0 ]; then
    exit $exit_status
fi
# Start running the unit tests...

cd ..
echo "Running schools related unit tests.."
python manage.py test unittests.schools --settings dubdubdub.test_settings
echo "Done with schools unit tests ----------"
echo "Running users related unit tests..."
python manage.py test unittests.users --settings dubdubdub.test_settings
echo "Done with users unit tests............."
echo "Running stories related unit tests"
python manage.py test unittests.stories --settings dubdubdub.test_settings
echo "Done with stories unit tests"


# Now, clean up the test database
source unittests/deleteTestDb.sh $testDB

<commit_msg>Modified unit tests to skip db creation<commit_after>#!/bin/bash
# Script usage: runtests.sh <Optional createDB: false>
# Example: To use existing test DB and not create a new one, use ./runtests.sh skipdbcreate
#This script runs all the existing unit tests for the users, schools and stories apps.
# You will need to create a "test" db by cloning the main databasee (eg. createdb -T klpwww_ver4 test_klpwww_ver4 )
#The name of the "test" DB should be entered in the dubdubdub/local_test_settings.py file. Please see those files for further instructions. 


# Create the test database from the dev DB

#Read the local settings file and get the name of the DB. Used a python script to read the DB name from DJango settings.
# Maybe a better way of doing this?
CREATE_DB=true

if [ $# -eq 1 ]; then
    echo $1
    CREATE_DB=$1
fi

# Call script to create test database if CREATE_DB is true

if [ "$CREATE_DB" == "true" ]; then
    testDB=''
    source createTestDb.sh
    exit_status=$?
    if [ $exit_status -ne 0 ]; then
        exit $exit_status
    fi
fi

# Start running the unit tests...

cd ..
echo "Running schools related unit tests.."
python manage.py test unittests.schools --settings dubdubdub.test_settings
echo "Done with schools unit tests ----------"
echo "Running users related unit tests..."
python manage.py test unittests.users --settings dubdubdub.test_settings
echo "Done with users unit tests............."
echo "Running stories related unit tests"
python manage.py test unittests.stories --settings dubdubdub.test_settings
echo "Done with stories unit tests"


# Now, clean up the test database (if it was created at all in the first place)
if [ "$CREATE_DB" == "true" ]; then
    source unittests/deleteTestDb.sh $testDB
fi


{'fraction_non_alphanumeric': 0.08568646543330087, 'fraction_numerical': 0.0029211295034079843, 'mean_word_length': 3.7342549923195083, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2720453', 'n_tokens_mistral': 899, 'n_tokens_neox': 878, 'n_words': 420}