def test_file_store_creation(tmppath): new = tmppath / 'test' FileStore.open(tmppath) with pytest.raises(NotADirectoryError): FileStore.open(new) with pytest.raises(FileExistsError): FileStore.create(tmppath) FileStore.create(new) FileStore.open(new) FileStore.ensure(tmppath / 'test2' / '2') FileStore.ensure(tmppath / 'test2')
def convert(store, usermap=None): issues, comments = bitbucket.stores(store) simple_store = FileStore.ensure(store.path / 'github_uploads') repo = store['repos']['bitbucket'] items = issues.items() usermap = usermap or store.get('users', {}) for key, issue in gprocess(items, label='Preparing Import Requests'): issue['comments'] = comments[key] simplified = bitbucket.simplify_issue(bb_issue=issue, repo=repo, usermap=usermap) simple_store[key] = simplified
def convert(store): issues, comments = bitbucket.stores(store) simple_store = FileStore.ensure(store.path / 'github_uploads') repo = store['repos']['bitbucket'] items = issues.items() for key, issue in gprocess(items, label='Preparing Import Requests'): issue['comments'] = comments[key] simplified = bitbucket.simplify_issue( bb_issue=issue, repo=repo, usermap=store.get('users', {})) simple_store[key] = simplified
def upload_github_issues(store, token): from wait_for import wait_for post = get_github_issue_poster(store, token) simple_store = FileStore.ensure(store.path / 'github_uploads') for issue in gprocess(sorted(simple_store, key=int), label='Uploading Import Requests'): response = post.get_issue(issue) if response.status_code == 200: raise ValueError(issue) post(simple_store.raw_data(issue)) def failure_check(response): print(repr(response.status_code), response.url) return response.status_code != 200 wait_for(post.get_issue, (issue, ), fail_condition=failure_check, timeout=500)
def upload_github_issues(store, token): from wait_for import wait_for post = get_github_issue_poster(store, token) simple_store = FileStore.ensure(store.path / 'github_uploads') for issue in gprocess(sorted(simple_store, key=int), label='Uploading Import Requests'): response = post.get_issue(issue) if response.status_code == 200: raise ValueError(issue) post(simple_store.raw_data(issue)) def failure_check(response): print(repr(response.status_code), response.url) return response.status_code != 200 wait_for( post.get_issue, (issue,), fail_condition=failure_check, timeout=500)
def init(*, path, bitbucket, github): store = FileStore.ensure(path) store['repos'] = {'bitbucket': bitbucket, 'github': github}
def init(*, path, bitbucket, github): store = FileStore.ensure(path) store['repos'] = { 'bitbucket': bitbucket, 'github': github }
def upload_github_issues(store, token): post = get_github_issue_poster(store, token) simple_store = FileStore.ensure(store.path / 'github_uploads') for issue in gprocess(simple_store, label='Uploading Import Requests'): post(simple_store.raw_data(issue))