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:
parent
0308fa49b1
commit
38302fd81a
|
@ -28,7 +28,7 @@ from subiquity.common.api.defs import api, Payload
|
||||||
|
|
||||||
from .test_server import (
|
from .test_server import (
|
||||||
makeTestClient,
|
makeTestClient,
|
||||||
TestControllerBase,
|
ControllerBase,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class TestEndToEnd(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET() -> str: ...
|
def GET() -> str: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self) -> str:
|
async def GET(self) -> str:
|
||||||
return 'value'
|
return 'value'
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ class TestEndToEnd(unittest.TestCase):
|
||||||
class nested:
|
class nested:
|
||||||
def GET() -> str: ...
|
def GET() -> str: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def endpoint_nested_GET(self) -> str:
|
async def endpoint_nested_GET(self) -> str:
|
||||||
return 'value'
|
return 'value'
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ class TestEndToEnd(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET(arg1: str, arg2: str) -> str: ...
|
def GET(arg1: str, arg2: str) -> str: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self, arg1: str, arg2: str) -> str:
|
async def GET(self, arg1: str, arg2: str) -> str:
|
||||||
return '{}+{}'.format(arg1, arg2)
|
return '{}+{}'.format(arg1, arg2)
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class TestEndToEnd(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET(arg1: str, arg2: str = "arg2") -> str: ...
|
def GET(arg1: str, arg2: str = "arg2") -> str: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self, arg1: str, arg2: str = "arg2") -> str:
|
async def GET(self, arg1: str, arg2: str = "arg2") -> str:
|
||||||
return '{}+{}'.format(arg1, arg2)
|
return '{}+{}'.format(arg1, arg2)
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ class TestEndToEnd(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def POST(data: Payload[dict]) -> str: ...
|
def POST(data: Payload[dict]) -> str: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def POST(self, data: dict) -> str:
|
async def POST(self, data: dict) -> str:
|
||||||
return data['key']
|
return data['key']
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class TestEndToEnd(unittest.TestCase):
|
||||||
class doubler:
|
class doubler:
|
||||||
def POST(data: In) -> Out: ...
|
def POST(data: In) -> Out: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def doubler_POST(self, data: In) -> Out:
|
async def doubler_POST(self, data: In) -> Out:
|
||||||
return Out(doubled=data.val*2)
|
return Out(doubled=data.val*2)
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ class TestEndToEnd(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET() -> int: ...
|
def GET() -> int: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self) -> int:
|
async def GET(self) -> int:
|
||||||
return 1/0
|
return 1/0
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ class TestEndToEnd(unittest.TestCase):
|
||||||
class bad:
|
class bad:
|
||||||
def GET(x: int) -> int: ...
|
def GET(x: int) -> int: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def good_GET(self, x: int) -> int:
|
async def good_GET(self, x: int) -> int:
|
||||||
return x + 1
|
return x + 1
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ class TestEndToEnd(unittest.TestCase):
|
||||||
class bad:
|
class bad:
|
||||||
def GET(x: int) -> int: ...
|
def GET(x: int) -> int: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def good_GET(self, x: int) -> int:
|
async def good_GET(self, x: int) -> int:
|
||||||
return x + 1
|
return x + 1
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class TestApp:
|
||||||
project = 'test'
|
project = 'test'
|
||||||
|
|
||||||
|
|
||||||
class TestControllerBase:
|
class ControllerBase:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.context = Context.new(TestApp())
|
self.context = Context.new(TestApp())
|
||||||
|
@ -72,7 +72,7 @@ class TestBind(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET() -> str: ...
|
def GET() -> str: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self) -> str:
|
async def GET(self) -> str:
|
||||||
return 'value'
|
return 'value'
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class TestBind(unittest.TestCase):
|
||||||
class nested:
|
class nested:
|
||||||
def get(): ...
|
def get(): ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def nested_get(self, request, context):
|
async def nested_get(self, request, context):
|
||||||
return 'nested'
|
return 'nested'
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ class TestBind(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET(arg: str): ...
|
def GET(arg: str): ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self, arg: str):
|
async def GET(self, arg: str):
|
||||||
return arg
|
return arg
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ class TestBind(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET(arg: str): ...
|
def GET(arg: str): ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self, arg: str):
|
async def GET(self, arg: str):
|
||||||
return arg
|
return arg
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class TestBind(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET(): ...
|
def GET(): ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self):
|
async def GET(self):
|
||||||
return 1/0
|
return 1/0
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class TestBind(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def POST(data: Payload[str]) -> str: ...
|
def POST(data: Payload[str]) -> str: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def POST(self, data: str) -> str:
|
async def POST(self, data: str) -> str:
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ class TestBind(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET(arg: str): ...
|
def GET(arg: str): ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
app = web.Application()
|
app = web.Application()
|
||||||
|
@ -192,7 +192,7 @@ class TestBind(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET(arg: str): ...
|
def GET(arg: str): ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self, arg: int):
|
async def GET(self, arg: int):
|
||||||
return arg
|
return arg
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ class TestBind(unittest.TestCase):
|
||||||
class API:
|
class API:
|
||||||
def GET() -> str: ...
|
def GET() -> str: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self) -> str:
|
async def GET(self) -> str:
|
||||||
return 1/0
|
return 1/0
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ class TestBind(unittest.TestCase):
|
||||||
class meth:
|
class meth:
|
||||||
def GET() -> str: ...
|
def GET() -> str: ...
|
||||||
|
|
||||||
class Impl(TestControllerBase):
|
class Impl(ControllerBase):
|
||||||
async def GET(self) -> str:
|
async def GET(self) -> str:
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue