mirror of
https://github.com/sprockets/sprockets-statsd.git
synced 2024-12-26 03:00:19 +00:00
Switch to asynctest for Py 3.7 support.
Decided to switch the tests to using asynctest so that we can guarantee support on Python 3.7 and newer. Also added pins in setup.cfg and a tox.ini file if you want to use it.
This commit is contained in:
parent
720dd79193
commit
f8c63a55fc
3 changed files with 37 additions and 14 deletions
16
setup.cfg
16
setup.cfg
|
@ -29,17 +29,17 @@ classifiers =
|
|||
[options]
|
||||
packages = find:
|
||||
install_requires =
|
||||
tornado
|
||||
tornado>=5
|
||||
|
||||
[options.extras_require]
|
||||
dev =
|
||||
coverage
|
||||
flake8
|
||||
flake8-import-order
|
||||
sphinx
|
||||
sphinx-autodoc-typehints
|
||||
tox
|
||||
yapf
|
||||
asynctest==0.13.0
|
||||
coverage==5.5
|
||||
flake8==3.8.4
|
||||
flake8-import-order==0.18.1
|
||||
sphinx==3.5.2
|
||||
sphinx-autodoc-typehints==1.11.1
|
||||
yapf==0.30.0
|
||||
|
||||
[options.packages.find]
|
||||
exclude =
|
||||
|
|
|
@ -1,15 +1,21 @@
|
|||
import asyncio
|
||||
import time
|
||||
import unittest
|
||||
|
||||
import asynctest
|
||||
|
||||
from sprockets_statsd import statsd
|
||||
from tests import helpers
|
||||
|
||||
|
||||
class ProcessorTestCase(unittest.IsolatedAsyncioTestCase):
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
class ProcessorTestCase(asynctest.TestCase):
|
||||
async def setUp(self):
|
||||
self.test_timeout = 5.0
|
||||
super().setUp()
|
||||
await self.asyncSetUp()
|
||||
|
||||
async def tearDown(self):
|
||||
await self.asyncTearDown()
|
||||
super().tearDown()
|
||||
|
||||
async def wait_for(self, fut):
|
||||
try:
|
||||
|
@ -18,7 +24,6 @@ class ProcessorTestCase(unittest.IsolatedAsyncioTestCase):
|
|||
self.fail('future took too long to resolve')
|
||||
|
||||
async def asyncSetUp(self):
|
||||
await super().asyncSetUp()
|
||||
self.statsd_server = helpers.StatsdServer()
|
||||
self.statsd_task = asyncio.create_task(self.statsd_server.run())
|
||||
await self.statsd_server.wait_running()
|
||||
|
@ -26,7 +31,6 @@ class ProcessorTestCase(unittest.IsolatedAsyncioTestCase):
|
|||
async def asyncTearDown(self):
|
||||
self.statsd_task.cancel()
|
||||
await self.statsd_server.wait_closed()
|
||||
await super().asyncTearDown()
|
||||
|
||||
|
||||
class ProcessorTests(ProcessorTestCase):
|
||||
|
|
19
tox.ini
Normal file
19
tox.ini
Normal file
|
@ -0,0 +1,19 @@
|
|||
[tox]
|
||||
envlist = lint,py37,py39,tornado5
|
||||
toxworkdir = ./build/tox
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
.[dev]
|
||||
commands =
|
||||
python -m unittest
|
||||
|
||||
[testenv:lint]
|
||||
commands =
|
||||
flake8 sprockets_statsd tests
|
||||
yapf -dr sprockets_statsd tests
|
||||
|
||||
[testenv:tornado5]
|
||||
deps =
|
||||
tornado>=5,<6
|
||||
.[dev]
|
Loading…
Reference in a new issue