c/api/tests: don't prefix class with Test

Fix warning:
  subiquity/common/api/tests/test_server.py:45
    PytestCollectionWarning: cannot collect test class
    'TestControllerBase' because it has a __init__ constructor
This commit is contained in:
Dan Bungert 2021-10-15 16:20:29 -06:00
parent 0308fa49b1
commit 38302fd81a
2 changed files with 21 additions and 21 deletions

View File

@ -28,7 +28,7 @@ from subiquity.common.api.defs import api, Payload
from .test_server import (
makeTestClient,
TestControllerBase,
ControllerBase,
)
@ -53,7 +53,7 @@ class TestEndToEnd(unittest.TestCase):
class API:
def GET() -> str: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self) -> str:
return 'value'
@ -70,7 +70,7 @@ class TestEndToEnd(unittest.TestCase):
class nested:
def GET() -> str: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def endpoint_nested_GET(self) -> str:
return 'value'
@ -85,7 +85,7 @@ class TestEndToEnd(unittest.TestCase):
class API:
def GET(arg1: str, arg2: str) -> str: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self, arg1: str, arg2: str) -> str:
return '{}+{}'.format(arg1, arg2)
@ -101,7 +101,7 @@ class TestEndToEnd(unittest.TestCase):
class API:
def GET(arg1: str, arg2: str = "arg2") -> str: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self, arg1: str, arg2: str = "arg2") -> str:
return '{}+{}'.format(arg1, arg2)
@ -119,7 +119,7 @@ class TestEndToEnd(unittest.TestCase):
class API:
def POST(data: Payload[dict]) -> str: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def POST(self, data: dict) -> str:
return data['key']
@ -145,7 +145,7 @@ class TestEndToEnd(unittest.TestCase):
class doubler:
def POST(data: In) -> Out: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def doubler_POST(self, data: In) -> Out:
return Out(doubled=data.val*2)
@ -161,7 +161,7 @@ class TestEndToEnd(unittest.TestCase):
class API:
def GET() -> int: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self) -> int:
return 1/0
@ -201,7 +201,7 @@ class TestEndToEnd(unittest.TestCase):
class bad:
def GET(x: int) -> int: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def good_GET(self, x: int) -> int:
return x + 1
@ -226,7 +226,7 @@ class TestEndToEnd(unittest.TestCase):
class bad:
def GET(x: int) -> int: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def good_GET(self, x: int) -> int:
return x + 1

View File

@ -42,7 +42,7 @@ class TestApp:
project = 'test'
class TestControllerBase:
class ControllerBase:
def __init__(self):
self.context = Context.new(TestApp())
@ -72,7 +72,7 @@ class TestBind(unittest.TestCase):
class API:
def GET() -> str: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self) -> str:
return 'value'
@ -90,7 +90,7 @@ class TestBind(unittest.TestCase):
class nested:
def get(): ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def nested_get(self, request, context):
return 'nested'
@ -106,7 +106,7 @@ class TestBind(unittest.TestCase):
class API:
def GET(arg: str): ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self, arg: str):
return arg
@ -122,7 +122,7 @@ class TestBind(unittest.TestCase):
class API:
def GET(arg: str): ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self, arg: str):
return arg
@ -143,7 +143,7 @@ class TestBind(unittest.TestCase):
class API:
def GET(): ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self):
return 1/0
@ -162,7 +162,7 @@ class TestBind(unittest.TestCase):
class API:
def POST(data: Payload[str]) -> str: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def POST(self, data: str) -> str:
return data
@ -179,7 +179,7 @@ class TestBind(unittest.TestCase):
class API:
def GET(arg: str): ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
pass
app = web.Application()
@ -192,7 +192,7 @@ class TestBind(unittest.TestCase):
class API:
def GET(arg: str): ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self, arg: int):
return arg
@ -215,7 +215,7 @@ class TestBind(unittest.TestCase):
class API:
def GET() -> str: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self) -> str:
return 1/0
@ -243,7 +243,7 @@ class TestBind(unittest.TestCase):
class meth:
def GET() -> str: ...
class Impl(TestControllerBase):
class Impl(ControllerBase):
async def GET(self) -> str:
return ''