Ejemplo n.º 1
0
def main():

    s = []
    results = []

    jsdir = util.relpath(__file__, r'..\media\js')
    results.extend(check_js_files(jsdir))

    htmldir = util.relpath(__file__, r'..\templates')
    results.extend(check_js_files(htmldir))

    if len(results):
        s.append('Found possible JS errors.')
        for result in results:
            s.append('  Filename: %s' % result['filename'])
            for i, error in enumerate(result['errors']):
                if len(result['errors']) > 1:
                    s.append('    Error #%s:' % (i + 1))
                for line in error.split('\n'):
                    s.append('      > %s' % line)

    s = '\n'.join(s)
    # Print output.
    print s

    # Email output.
    util.send_admin_email('Test report', s)
Ejemplo n.º 2
0
def main():
    import re

    svn_info = get_svn_info(relpath(__file__, '..'))
    revision = svn_info['revision']

    # Run the django 'test' command, capture the output.

    import subprocess
    proc = subprocess.Popen(
        [sys.executable,
         relpath(__file__, '../manage.py'), 'test'],
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE)
    output, err_output = proc.communicate()

    # Parse the results to see if there was an error.

    success_matches = re.search(r'Ran (\d+) tests in (\d\.\d+)s\n\nOK',
                                err_output)

    if success_matches:
        # No errors.
        subject = 'Tests passed for rev %s.' % revision
        body = subject
    else:
        # Found errors.
        matches = re.search(r'FAILED \(failures=(\d+)\)', err_output)
        if matches:
            num_errors = matches.group(1)
        else:
            num_errors = '(Unknown)'
        subject = '*** Tests failed for rev %s, %s errors.' % (revision,
                                                               num_errors)
        body = err_output

    print subject
    print body

    send_admin_email(subject, body)
Ejemplo n.º 3
0
def main():
    from core.util import get_svn_info, relpath, send_admin_email
    import subprocess
    import time
    import getopt
    from cStringIO import StringIO

    log_filename = None

    opts, args = getopt.getopt(sys.argv[1:], 'l:')
    for name, value in opts:
        if name == '-l':
            log_filename = value

    if log_filename:
        old_stdout = sys.stdout
        old_stderr = sys.stderr

        #sys.stdout = StringIO()
        #sys.stderr = StringIO()

        sys.stdout = open(log_filename, 'a', 0)
        sys.stderr = sys.stdout

    print '----------------------------------------------------------------------'

    try:
        path = relpath(__file__, '..')

        url = svn_info = get_svn_info(path)['url']

        print 'Checking repo %s' % url

        # Run the first set of tests, regardless if the SVN is newer.
        print 'Running tests.'
        subprocess.call([sys.executable, 'run_tests.py'], )

        while True:
            local_rev = get_svn_info(path)['revision']
            remote_rev = get_svn_info(url)['revision']

            if remote_rev is not None and local_rev != remote_rev:
                # The SVN is newer than the working-copy, update & test.
                print 'Updating working copy to latest revision.'
                print 'local_rev: %s' % local_rev
                print 'remote_rev: %s' % remote_rev

                #subject = 'Updating working copy from %s to %s' % (local_rev, remote_rev)
                #send_admin_email(subject, subject)

                subprocess.call(['svn', 'update', path], )

                print 'Running tests.'
                subprocess.call([sys.executable, 'run_tests.py'], )

                print '...'
            time.sleep(60)

    except KeyboardInterrupt:
        # Killed by keyboard.
        pass

    except Exception, e:
        print 'EXCEPTION: %r' % e
        subject = 'Test runner quit with exception %r' % e
        send_admin_email(subject, subject)
Ejemplo n.º 4
0
import os
import glob
import sys

sys.path.insert(0, '..')
import ieeetags.settings
from core import util

root = util.relpath(__file__, '..')
folder = os.path.join(
    root,
    settings.PROFILER_OUTPUT_ROOT,
)
for filename in glob.glob(folder + '/*.profile_out'):
    print filename
    base, ext = os.path.splitext(filename)
    #print base
    #print ext
    graph_filename = base + '.png'
    #print graph_filename
    if not os.path.exists(graph_filename):
        print '  Creating graph...'
        os.system('gprof2dot.py -f pstats %s | dot -Tpng -o %s' %
                  (filename, graph_filename))
Ejemplo n.º 5
0
# system time zone.
TIME_ZONE = 'America/New_York'

# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'

SITE_ID = 1

# If you set this to False, Django will make some optimizations so as not
# to load the internationalization machinery.
USE_I18N = True

# Absolute path to the directory that holds media.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT = relpath(__file__, 'media')
STATIC_ROOT = relpath(__file__, 'static')
CACHED_MEDIA_ROOT = os.path.join(MEDIA_ROOT, 'caches')

# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
# Examples: "http://media.lawrence.com", "http://example.com/media/"
MEDIA_URL = '/media/'
CACHED_MEDIA_URL = MEDIA_URL + 'caches/'

# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
ADMIN_MEDIA_PREFIX = '/admin_media/'

LOGIN_URL = '/admin/login'