Ejemplo n.º 1
0
def test(full=False):
    """Test and validates the written html files"""
    trials_org = pk.load(open(os.path.join(TMPDIR, TRIALS)))

    fns_sandbox = sorted(glob.glob(os.path.join(
        TMPDIR_SANDBOX, '*.html')))
    fns_production = sorted(glob.glob(os.path.join(
        TMPDIR_PRODUCTION, '*.html')))

    print '* Testing sandbox...'
    ut.validate_html_files(fns_sandbox,
            rules=ut.PREP_RULE_SIMPLE_RSVP_SANDBOX,
            trials_org=trials_org)
    print '* Testing production...'
    ut.validate_html_files(fns_production,
            rules=ut.PREP_RULE_SIMPLE_RSVP_PRODUCTION,
            trials_org=trials_org)

    if full:
        ids = [e[0].split('/')[-1] for e in trials_org]
        ids = np.unique(ids)
        print '* Making sure all images are there:', len(ids)
        _, bucket = mt.connect_s3(section_name='MTurkCredentials_esolomon',
                bucketname=S3BUCKET_FULLOBJT)
        for i, e in enumerate(ids):
            assert mt.exists_s3(bucket, e)
            if i % 100 == 0:
                print ' ->', i
Ejemplo n.º 2
0
def test():
    """Test and validates the written html files"""
    trials_org = pk.load(open(os.path.join(TMPDIR, TRIALS)))

    fns_sandbox = sorted(glob.glob(os.path.join(TMPDIR_SANDBOX, '*.html')))
    fns_production = sorted(
        glob.glob(os.path.join(TMPDIR_PRODUCTION, '*.html')))

    print '* Testing sandbox...'
    ut.validate_html_files(fns_sandbox,
                           rules=ut.PREP_RULE_SIMPLE_RSVP_SANDBOX,
                           trials_org=trials_org)
    print '* Testing production...'
    ut.validate_html_files(fns_production,
                           rules=ut.PREP_RULE_SIMPLE_RSVP_PRODUCTION,
                           trials_org=trials_org)