Skip to content

Commit

Permalink
Set up Travis & Coveralls
Browse files Browse the repository at this point in the history
* Drop python3.5 support (see below)
* Pin some dependency versions that were breaking on Travis
* Add badges to README

Python 3.5: some tweaks were needed to get the tests running on
Python 3.5 (mainly async_generator and pathlib/open stuff), but
the tests would hang on Travis. I compiled Python 3.5 locally and
the tests ran fine every time. I tried a few esoteric debug
techniques like `timeout -s SIGINT 5 pytest` which should kill
pytest during the hung test and print a stack trace, but that
didn't work so I gave up and just removed Python 3.5 support. I'm
happy to add it back later if somebody can figure it out, but I
can't afford to keep toying with it right now.
  • Loading branch information
mehaase committed Oct 12, 2018
1 parent 9fa4c8a commit 17b6654
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,5 +1,7 @@
.coverage
.pytest_cache
__pycache__
coverage.xml
dist
examples/fake.*
trio_websocket.egg-info
Expand Down
20 changes: 20 additions & 0 deletions .travis.yml
@@ -0,0 +1,20 @@
language: python

git:
depth: 1

matrix:
include:
- python: 3.6
- python: 3.7
dist: xenial
sudo: true

install:
- pip install .[dev]

script:
- pytest --cov=trio_websocket

after_success:
- coveralls
6 changes: 6 additions & 0 deletions README.md
@@ -1,3 +1,9 @@
[![Build Status](https://img.shields.io/travis/HyperionGray/trio-websocket.svg?style=flat-square)](https://travis-ci.org/HyperionGray/trio-websocket)
[![Coverage](https://img.shields.io/coveralls/github/HyperionGray/trio-websocket.svg?style=flat-square)](https://coveralls.io/github/HyperionGray/trio-websocket?branch=master)
[![PyPI](https://img.shields.io/pypi/v/trio-websocket.svg?style=flat-square)](https://pypi.org/project/trio-websocket/)
[![Python Versions](https://img.shields.io/pypi/pyversions/trio-websocket.svg)]
![MIT License](https://img.shields.io/github/license/HyperionGray/trio-websocket.svg?style=flat-square)]

# Trio WebSocket

This project implements [the WebSocket
Expand Down
14 changes: 11 additions & 3 deletions setup.py
Expand Up @@ -28,21 +28,29 @@
'Intended Audience :: Developers',
'Topic :: Software Development :: Libraries',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
],
python_requires=">=3.6",
keywords='websocket client server trio',
packages=find_packages(exclude=['docs', 'examples', 'tests']),
install_requires=[
'async_generator',
'attrs',
'attrs>=18.2',
'ipaddress',
'trio>=0.8',
'wsaccel',
'wsproto',
'yarl'
],
extras_require={
'dev': ['pytest', 'pytest-trio', 'trustme'],
'dev': [
'coveralls',
'pytest>=3.6',
'pytest-cov',
'pytest-trio',
'trustme',
],
},
project_urls={
'Bug Reports': 'https://github.com/HyperionGray/trio-websocket/issues',
Expand Down
5 changes: 2 additions & 3 deletions trio_websocket/__init__.py
Expand Up @@ -4,7 +4,7 @@
import ssl
from functools import partial

from async_generator import async_generator, yield_, asynccontextmanager
from async_generator import asynccontextmanager
import attr
from ipaddress import ip_address, IPv4Address, IPv6Address
import trio
Expand All @@ -23,7 +23,6 @@


@asynccontextmanager
@async_generator
async def open_websocket(host, port, resource, use_ssl):
'''
Open a WebSocket client connection to a host.
Expand All @@ -45,7 +44,7 @@ async def open_websocket(host, port, resource, use_ssl):
connection = await connect_websocket(new_nursery, host, port, resource,
use_ssl)
async with connection:
await yield_(connection)
yield connection


async def connect_websocket(nursery, host, port, resource, use_ssl):
Expand Down

0 comments on commit 17b6654

Please sign in to comment.