def setup(self):
        """Prepare the repository and virtualenvs."""        
        try:
            os.mkdir(basedir)
        except __HOLE__ as e:
            if e.errno != errno.EEXIST:
                raise
        os.chdir(basedir)
        
        # Delete virtualenvs and recreate
        for venv in glob('venv-*'):
            shutil.rmtree(venv)
        for py in self.available_python_versions():
            check_call(['virtualenv', '-p', py,
                            '--system-site-packages', 'venv-%s' % py])

            self.venvs.append((py, 'venv-%s' % py))
        
        # Check out and update the repository
        if not os.path.exists('networkx'):
            try :
                check_call(['git', 'clone', nx_repository])
            except CalledProcessError:
                check_call(['git', 'clone', nx_http_repository])
        os.chdir(repodir)
        check_call(['git', 'checkout', 'master'])
        try :
            check_call(['git', 'pull', 'origin', 'master'])
        except CalledProcessError:
            check_call(['git', 'pull', nx_http_repository, 'master'])
        self.master_sha = check_output(['git', 'log', '-1', 
                                        '--format=%h']).decode('ascii').strip()
        os.chdir(basedir)
dataset/ETHPy150Open networkx/networkx/tools/test_pr.py/TestRun.setup