Skip to content

Instantly share code, notes, and snippets.

@juntatalor
juntatalor / app.py
Last active October 24, 2018 13:42
Async file write with tornado
import os
from uuid import uuid4
from tornado import web
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.iostream import PipeIOStream
IOLoop.configure('tornado.platform.asyncio.AsyncIOMainLoop')
@juntatalor
juntatalor / test_example.py
Created August 11, 2016 15:14 — forked from robcowie/test_example.py
py.test fixtures for testing tornado apps
def test_root_output(client):
resp = client.fetch('/')
assert resp.code == 200
assert resp.body == 'Hello, world'
def test_async_output(client):
resp = client.fetch('/async')
assert resp.code == 200
@juntatalor
juntatalor / jira_utils.py
Created August 10, 2016 07:29
Tornado, pytest & jsonschema Jira api async testing
import json
from tornado.httpclient import AsyncHTTPClient
class JiraClient(object):
def __init__(self, jira_server, jira_user, jira_password):
self.__jira_server = jira_server
self.__jira_user = jira_user
self.__jira_password = jira_password