How to use the psiturk.experiment function in PsiTurk

To help you get started, we’ve selected a few PsiTurk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NYUCCL / psiTurk / tests / test_psiturk.py View on Github external
def do_it():
        import psiturk.experiment
        reload(psiturk.experiment)
        psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
            psiturk.experiment.app.wsgi_app)
        return psiturk.experiment.app
    yield do_it
github NYUCCL / psiTurk / tests / test_psiturk.py View on Github external
def do_it():
        import psiturk.experiment
        reload(psiturk.experiment)
        psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
            psiturk.experiment.app.wsgi_app)
        return psiturk.experiment.app
    yield do_it
github NYUCCL / psiTurk / tests / test_tasks.py View on Github external
from psiturk.tasks import do_campaign_round
    
    campaign_args = {
        'campaign': campaign,
        'job_id': campaign.campaign_job_id
    }
    
    from psiturk.experiment import app
    mocker.patch.object(app.apscheduler,
        'remove_job', lambda *args, **kwargs: True)
        
    import psiturk.tasks
    mocker.patch.object(psiturk.models.Participant, 'count_completed', lambda *args, **kwargs: campaign.goal)
    
    import psiturk.experiment
    remove_job_mock = mocker.patch.object(psiturk.experiment.app.apscheduler, 'remove_job')
    do_campaign_round(**campaign_args)
    remove_job_mock.assert_called()
github NYUCCL / psiTurk / tests / test_psiturk.py View on Github external
def setUp(self, case=None):
        '''Build up fixtures'''
        import psiturk.experiment
        reload(psiturk.experiment)
        
        psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
            psiturk.experiment.app.wsgi_app)
        self.app = psiturk.experiment.app.test_client()
        self.config = psiturk.experiment.CONFIG

        # Fake MTurk data
        self.worker_id = fake.md5(raw_output=False)
        self.hit_id = fake.md5(raw_output=False)
        self.assignment_id = fake.md5(raw_output=False)
github NYUCCL / psiTurk / tests / test_psiturk.py View on Github external
def setUp(self, case=None):
        '''Build up fixtures'''
        import psiturk.experiment
        reload(psiturk.experiment)
        
        psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
            psiturk.experiment.app.wsgi_app)
        self.app = psiturk.experiment.app.test_client()
        self.config = psiturk.experiment.CONFIG

        # Fake MTurk data
        self.worker_id = fake.md5(raw_output=False)
        self.hit_id = fake.md5(raw_output=False)
        self.assignment_id = fake.md5(raw_output=False)
github NYUCCL / psiTurk / tests / test_tasks.py View on Github external
}
    
    from psiturk.experiment import app
    mocker.patch.object(app.apscheduler,
        'remove_job', lambda *args, **kwargs: True)
    
    from psiturk.amt_services_wrapper import MTurkServicesWrapper
    aws_services_wrapper = MTurkServicesWrapper()
    aws_services_wrapper.config['Task Parameters']['experiment_code_version'] = '1.1'
    
    import psiturk.tasks
    mocker.patch.object(psiturk.tasks.TaskUtils, 'aws_services_wrapper', aws_services_wrapper)
    
    
    import psiturk.experiment    
    remove_job_mock = mocker.patch.object(psiturk.experiment.app.apscheduler, 'remove_job')
    do_campaign_round(**campaign_args)
    remove_job_mock.assert_called()
github NYUCCL / psiTurk / tests / test_psiturk.py View on Github external
def setUp(self, case=None):
        '''Build up fixtures'''
        import psiturk.experiment
        reload(psiturk.experiment)
        
        psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
            psiturk.experiment.app.wsgi_app)
        self.app = psiturk.experiment.app.test_client()
        self.config = psiturk.experiment.CONFIG

        # Fake MTurk data
        self.worker_id = fake.md5(raw_output=False)
        self.hit_id = fake.md5(raw_output=False)
        self.assignment_id = fake.md5(raw_output=False)
github NYUCCL / psiTurk / psiturk / __main__.py View on Github external
from __future__ import absolute_import

if __name__ == '__main__':
    from . import experiment
    experiment.run_webserver()