Twisted tests will generally look like:
@twisted_utils.reacts # marks the test as needing a reactor
# marks the function as a coroutine, a poor immitation of a Python3 async/def
# coroutine
@twisted_utils.inlineCallbacks
def test_foo(fixtures)
#!/usr/bin/env python3 | |
import sys | |
import asyncio | |
import json | |
import websockets | |
async def hello(): | |
uri = "ws://localhost:8888" |
2021-08-24 09:11:54.057 | ERROR | __main__:get:51 - http get failed with exception url: https://hyper.dev, <class 'RuntimeError'> | |
Traceback (most recent call last): | |
File "/home/graingert/.virtualenvs/testingpypy37/site-packages/httpcore/_backends/anyio.py", line 60, in read | |
return await self.stream.receive(n) | |
│ │ │ └ 65536 | |
│ │ └ <function TLSStream.receive at 0x00007f0102d79920> | |
│ └ TLSStream(transport_stream=<anyio._backends._asyncio.SocketStream object at 0x00007f010434cb80>, standard_compatible=False, _... | |
└ <httpcore._backends.anyio.SocketStream object at 0x00005651a1184608> |
import curio | |
import collections | |
import threading | |
class Locals(threading.local): | |
synchrotron = None | |
tlocals = Locals() |
_i = iter(EXPR) | |
try: | |
_y = next(_i) | |
except StopIteration as _e: | |
_r = _e.value | |
else: | |
while 1: | |
try: | |
_s = yield _y | |
except GeneratorExit as _e: |
from __future__ import annotations | |
# with thanks to https://adamj.eu/tech/2020/10/15/a-single-file-rest-api-in-django/ | |
import os | |
import sys | |
from dataclasses import dataclass | |
import treq | |
import asyncio | |
import asgiref.sync |
# /opt/libreofficedev7.1/program/python test2.py | |
2004 177 | |
2003 176 | |
2002 175 | |
2005 178 | |
2002 181 | |
2003 180 | |
2004 179 | |
2005 182 | |
^Cunhandled exception during asyncio.run() shutdown |
import JsEither._ | |
case class Page(id: Int, name: String, screen_name: String, is_closed: Int, photo_50: String, photo_100: String, photo_200: String) | |
object Page { | |
implicit val format = Json.format[Page] | |
} | |
case class Profile(id: Int, first_name: String, last_name: String) | |
object Profile { | |
implicit val format = Json.format[Profile] |
FROM ubuntu:xenial | |
COPY ./apt-keys.pub /tmp/apt-keys.pub | |
RUN echo "deb http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial main" > /etc/apt/sources.list.d/deadsnakes.list \ | |
&& apt-key add /tmp/apt-keys.pub && rm /tmp/apt-keys.pub \ | |
&& apt-get update && apt-get install -y --no-install-recommends libgtk2.0 libwebkitgtk-3.0 \ | |
build-essential python2.7-dev python3.7-dev python3.7-venv python-virtualenv \ | |
libjpeg8 libtiff5 libsdl1.2debian libnotify4 freeglut3 libsm6 \ | |
libgl1-mesa-glx libgstreamer-plugins-base0.10 libwebkit2gtk-4.0-37 git \ | |
&& rm -rf /var/lib/apt/lists/* |
import pathlib | |
import ast | |
def _packages(path): | |
return _include_parents(path.with_suffix('').parts) | |
def _include_parents(parts): | |
p = list(parts) |