RSDK-13254: example tests#1079
Conversation
…into RSDK-13254
| @@ -1,4 +1,4 @@ | |||
| from typing import ClassVar, Mapping, Sequence, cast | |||
There was a problem hiding this comment.
FAILED tests/test_examples.py::TestExamplesImports::test_python_file_imports[optionaldepsmodule/module.py] - TypeError: 'type' object is not subscriptable
this was incompatible with python 3.8.2
| return await self.left.is_moving() or await self.right.is_moving() | ||
|
|
||
| # Not implemented | ||
| async def get_properties(self, *, timeout: Optional[float] | None = None, **kwargs) -> Base.Properties: |
There was a problem hiding this comment.
FAILED tests/test_examples.py::TestExamplesImports::test_python_file_imports[complex_module/src/base/my_base.py] - TypeError: unsupported operand type(s) for |: '_GenericAlias' and 'NoneType'
This was incompatible with version 3.8.2
| req = ReadyRequest(parent_address=p_addr) | ||
| resp = await module.ready(req) | ||
| assert module._parent_address == p_addr | ||
| assert len(resp.handlermap.handlers) == 2 |
There was a problem hiding this comment.
this test is failing because my text_examples register resources as they build the files. To fix it, I made it so instead of checking the length of handlermap.handlers, it iterates through them looking for the resource and then ensures that model is correct and theres only one of them
stuqdog
left a comment
There was a problem hiding this comment.
this all looks reasonable to me, but there isn't any detail in the description as to what the goal is here and I don't have that context already, so I'm a bit hesitant to approve. Is it the case that we're just validating that imports work? It doesn't look like this actually uses the examples in any meaningful way, unless I'm missing something?
My understanding is that this epic just makes sure that everything builds and doesn't go deeper into checking it builds exactly as we intend it to(future feature?). I can confirm in today's meeting |
njooma
left a comment
There was a problem hiding this comment.
In last week's meeting, we decided to not test imports but rather test BUILDING the modules. This can be done by importing the server side code and client side code into a test, then running both to make sure everything is behaving as expected
This reverts commit 4f78cf5.
| for d in sorted(EXAMPLES_DIR.iterdir()): | ||
| if not d.is_dir(): | ||
| continue | ||
| for candidate in [d / "src" / "main.py", d / "main.py", d / "module.py", d / "v1" / "server.py"]: |
There was a problem hiding this comment.
theres no consistent entrypoint in the examples, so to keep it dynamic (in case we add new examples in the future) I'm just adding in the most popular ones)
No description provided.