Esempio n. 1
0
def experiment_dir():
    import shutil
    shutil.rmtree('psiturk-example', ignore_errors=True)
    import psiturk.setup_example as se
    se.setup_example()

    # change config file...
    with open('config.txt', 'r') as file:
        config_file = file.read()

    config_file = config_file.replace('use_psiturk_ad_server = true',
                                      'use_psiturk_ad_server = false')

    with open('config.txt', 'w') as file:
        file.write(config_file)

    # os.chdir('psiturk-example') # the setup script already chdirs into here, although I don't like that it does that
    os.environ['AWS_ACCESS_KEY_ID'] = 'foo'
    os.environ['AWS_SECRET_ACCESS_KEY'] = 'bar'
    os.environ['AWS_DEFAULT_REGION'] = 'us-west-2'
    os.environ.pop('AWS_PROFILE', None)

    yield
    os.chdir('..')
    shutil.rmtree('psiturk-example', ignore_errors=True)
Esempio n. 2
0
def experiment_dir(tmpdir, bork_aws_environ, edit_config_file):
    # pytest.set_trace()
    os.chdir(tmpdir)
    import psiturk.setup_example as se
    se.setup_example()
    edit_config_file('use_psiturk_ad_server = true', 'use_psiturk_ad_server = false')
    # os.chdir('psiturk-example') # the setup script already chdirs into here, although I don't like that it does that
    yield

    os.chdir('..')
    shutil.rmtree('psiturk-example')
Esempio n. 3
0
def experiment_dir(tmpdir, bork_aws_environ, edit_config_file):
    os.chdir(tmpdir)
    import psiturk.setup_example as se
    se.setup_example()
    os.environ['PSITURK_AD_URL_DOMAIN'] = 'example.com'

    # the setup script already chdirs into here,
    # although I don't like that it does that
    # os.chdir('psiturk-example')
    yield

    os.chdir('..')
    shutil.rmtree('psiturk-example')
Esempio n. 4
0
def experiment_dir(tmpdir, bork_aws_environ, edit_config_file):
    os.chdir(tmpdir)
    import psiturk.setup_example as se
    se.setup_example()
    file_util.move_file(os.path.join(os.getcwd(), 'config.txt.sample'),
                        os.path.join(os.getcwd(), 'config.txt'))
    file_util.move_file(os.path.join(os.getcwd(), 'custom.py.sample'),
                        os.path.join(os.getcwd(), 'custom.py'))
    os.environ['PSITURK_AD_URL_DOMAIN'] = 'example.com'

    # the setup script already chdirs into here,
    # although I don't like that it does that
    # os.chdir('psiturk-example')
    yield

    os.chdir('..')
    shutil.rmtree('psiturk-example')
Esempio n. 5
0
def setup_example():
    ''' Add commands for testing, etc. '''
    parser = argparse.ArgumentParser(
        description='Creates a simple default project (stroop) in the current\
        directory with the necessary psiTurk files.')

    # Optional flags
    parser.add_argument('-v',
                        '--version',
                        help='Print version number.',
                        action="store_true")
    args = parser.parse_args()

    # If requested version just print and quite
    if args.version:
        print version_number
    else:
        import psiturk.setup_example as se
        se.setup_example()
Esempio n. 6
0
def setup_example():
    ''' Add commands for testing, etc. '''
    parser = argparse.ArgumentParser(
        description='Creates a simple default project (stroop) in the current\
        directory with the necessary psiTurk files.'
    )

    # Optional flags
    parser.add_argument(
        '-v', '--version', help='Print version number.', action="store_true"
    )
    args = parser.parse_args()

    # If requested version just print and quite
    if args.version:
        print version_number
    else:
        import psiturk.setup_example as se
        se.setup_example()
Esempio n. 7
0
def do_setup():
    shutil.rmtree('psiturk-example', ignore_errors=True)
    import psiturk.setup_example as se
    se.setup_example()

    # change config file...
    with open('config.txt', 'r') as file:
        config_file = file.read()

    config_file = config_file.replace(
        'use_psiturk_ad_server = true', 'use_psiturk_ad_server = false')
    config_file = config_file.replace(
        'ad_location = false', 'ad_location = https://example.test/pub')

    with open('config.txt', 'w') as file:
        file.write(config_file)

    # os.chdir('psiturk-example') # the setup script already chdirs into here, although I don't like that it does that
    os.environ['AWS_ACCESS_KEY_ID'] = 'foo'
    os.environ['AWS_SECRET_ACCESS_KEY'] = 'bar'
    os.environ.pop('AWS_PROFILE', None)