-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
move reset from setup to teardown #33
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,8 @@ class LeHostTest(base_test.BaseTestClass): # type: ignore[misc] | |
dut: PandoraDevice | ||
ref: PandoraDevice | ||
|
||
def setup_class(self) -> None: | ||
@avatar.asynchronous | ||
async def setup_class(self) -> None: | ||
self.devices = PandoraDevices(self) | ||
self.dut, self.ref, *_ = self.devices | ||
|
||
|
@@ -60,13 +61,16 @@ def setup_class(self) -> None: | |
if isinstance(device, BumblePandoraDevice): | ||
device.config.setdefault('classic_enabled', True) | ||
|
||
await asyncio.gather(self.dut.reset(), self.ref.reset()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
|
||
def teardown_class(self) -> None: | ||
if self.devices: | ||
self.devices.stop_all() | ||
|
||
@avatar.asynchronous | ||
async def setup_test(self) -> None: # pytype: disable=wrong-arg-types | ||
await asyncio.gather(self.dut.reset(), self.ref.reset()) | ||
async def teardown_test(self) -> None: | ||
if self.results.is_test_executed(self.current_test_info.name): # type: ignore | ||
await asyncio.gather(self.dut.reset(), self.ref.reset()) | ||
|
||
@avatar.parameterized( | ||
*itertools.product( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,8 @@ class LeSecurityTest(base_test.BaseTestClass): # type: ignore[misc] | |
dut: PandoraDevice | ||
ref: PandoraDevice | ||
|
||
def setup_class(self) -> None: | ||
@avatar.asynchronous | ||
async def setup_class(self) -> None: | ||
self.devices = PandoraDevices(self) | ||
self.dut, self.ref, *_ = self.devices | ||
|
||
|
@@ -46,13 +47,16 @@ def setup_class(self) -> None: | |
if isinstance(device, BumblePandoraDevice): | ||
device.config.setdefault('classic_enabled', True) | ||
|
||
await asyncio.gather(self.dut.reset(), self.ref.reset()) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
|
||
def teardown_class(self) -> None: | ||
if self.devices: | ||
self.devices.stop_all() | ||
|
||
@avatar.asynchronous | ||
async def setup_test(self) -> None: # pytype: disable=wrong-arg-types | ||
await asyncio.gather(self.dut.reset(), self.ref.reset()) | ||
async def teardown_test(self) -> None: | ||
if self.results.is_test_executed(self.current_test_info.name): # type: ignore | ||
await asyncio.gather(self.dut.reset(), self.ref.reset()) | ||
|
||
async def handle_pairing_events(self) -> NoReturn: | ||
ref_pairing_stream = self.ref.aio.security.OnPairing() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,11 @@ def teardown_class(self) -> None: | |
if self.devices: | ||
self.devices.stop_all() | ||
|
||
@avatar.asynchronous | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you remove the reset on |
||
async def teardown_test(self) -> None: | ||
if self.results.is_test_executed(self.current_test_info.name): # type: ignore | ||
await asyncio.gather(self.dut.reset(), self.ref.reset()) | ||
|
||
@avatar.parameterized( | ||
*itertools.product( | ||
('outgoing_connection', 'incoming_connection'), | ||
|
@@ -142,9 +147,6 @@ async def test_ssp( | |
if not isinstance(self.ref, BumblePandoraDevice) and ref_io_capability != 'against_default_io_cap': | ||
raise signals.TestSkip('Unable to override IO capability on non Bumble device.') | ||
|
||
# Factory reset both DUT and REF devices. | ||
await asyncio.gather(self.dut.reset(), self.ref.reset()) | ||
|
||
# Override REF IO capability if supported. | ||
if isinstance(self.ref, BumblePandoraDevice): | ||
io_capability = { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reset on setup class isnt necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we don't have a reset on the setup_class, then if the test is skipped and there is only one test then it's gonna hang for ever on the Pandora apk shutdown. Maybe we can do the reset in the teardown in the case we have only one test and it is skipped. What do you think ?