Skip to content
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

fix(power-cycle): Make all occurrences of power cycles respect the --power-cycle-sleep parameter. #523

Merged
merged 1 commit into from
Apr 10, 2024

Conversation

emedav
Copy link
Contributor

@emedav emedav commented Apr 5, 2024

Using --power-cycle-sleep, scanners can be told to sleep for a certain amount of time between power-off and power-on of the test-setup. However, this parameter was only actually used at one of multiple occurrences of these events in the code so far.

@emedav emedav requested review from rumpelsepp and peckto as code owners April 5, 2024 15:43
await self.reconnect()
await self.wait_for_ecu()

resp = await self.set_session(0x01, config=config)
if isinstance(resp, service.NegativeResponse):
await self.power_cycle()
await self.power_cycle(**power_cycle_args)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just self.power_cycle(sleep)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To allow for using the default sleep time defined in power_cycle() without repeating its definition in leave_session(). The latter might be easily overseen, should the definition in power_cycle() be updated in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you use **power_cycle_args it does not get catched by mypy. When you use plain sleep as an argument it is all statically typed.

@rumpelsepp rumpelsepp force-pushed the power-cycle-sleep-everywhere branch from 952ac05 to 1ba52a7 Compare April 10, 2024 14:24
@rumpelsepp rumpelsepp merged commit c137cd5 into master Apr 10, 2024
9 checks passed
@rumpelsepp rumpelsepp deleted the power-cycle-sleep-everywhere branch April 10, 2024 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants