Browse Source

Add tests/CI, fix playable import error on py3

feature/storage
Andrei 8 years ago
parent
commit
e78c99b605
  1. 12
      .travis.yml
  2. 2
      disco/voice/playable.py
  3. 9
      setup.py
  4. 42
      tests/test_imports.py

12
.travis.yml

@ -0,0 +1,12 @@
langauge: python
python:
- '2.7'
- '3.2'
- '3.3'
- '3.4'
- '3.5'
- '3.6'
- 'nightly'
script: 'python setup.py test'

2
disco/voice/playable.py

@ -14,7 +14,7 @@ from disco.voice.opus import OpusEncoder
try: try:
from cStringIO import cStringIO as StringIO from cStringIO import cStringIO as StringIO
except: except:
from StringIO import StringIO from six import StringIO
OPUS_HEADER_SIZE = struct.calcsize('<h') OPUS_HEADER_SIZE = struct.calcsize('<h')

9
setup.py

@ -2,6 +2,14 @@ from setuptools import setup, find_packages
from disco import VERSION from disco import VERSION
def run_tests():
import unittest
test_loader = unittest.TestLoader()
test_suite = test_loader.discover('tests', pattern='test_*.py')
return test_suite
with open('requirements.txt') as f: with open('requirements.txt') as f:
requirements = f.readlines() requirements = f.readlines()
@ -19,6 +27,7 @@ setup(
long_description=readme, long_description=readme,
include_package_data=True, include_package_data=True,
install_requires=requirements, install_requires=requirements,
test_suite='setup.run_tests',
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',
'License :: OSI Approved :: MIT License', 'License :: OSI Approved :: MIT License',

42
tests/test_imports.py

@ -0,0 +1,42 @@
"""
This module tests that all of disco can be imported, mostly to help reduce issues
with untested code that will not even parse/run on Py2/3
"""
from disco.api.client import *
from disco.api.http import *
from disco.api.ratelimit import *
from disco.bot.bot import *
from disco.bot.command import *
from disco.bot.parser import *
from disco.bot.plugin import *
from disco.bot.storage import *
from disco.gateway.client import *
from disco.gateway.events import *
from disco.gateway.ipc import *
from disco.gateway.packets import *
# Not imported, GIPC is required but not provided by default
# from disco.gateway.sharder import *
from disco.types.base import *
from disco.types.channel import *
from disco.types.guild import *
from disco.types.invite import *
from disco.types.message import *
from disco.types.permissions import *
from disco.types.user import *
from disco.types.voice import *
from disco.types.webhook import *
from disco.util.backdoor import *
from disco.util.config import *
from disco.util.functional import *
from disco.util.hashmap import *
from disco.util.limiter import *
from disco.util.logging import *
from disco.util.serializer import *
from disco.util.snowflake import *
from disco.util.token import *
from disco.util.websocket import *
from disco.voice.client import *
from disco.voice.opus import *
from disco.voice.packets import *
from disco.voice.playable import *
from disco.voice.player import *
Loading…
Cancel
Save