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

Adds hurry up and grace period features to multiball ball save #1590

Merged
merged 9 commits into from
Aug 10, 2021

Conversation

atummons
Copy link
Contributor

@atummons atummons commented Aug 2, 2021

Added hurry up and grace period features to the multiball ball save. This allows the user to run shows off the hurry up, as well as provide a grace period for saves.

The tests for test_Modes are failing when I run bulk, but run fine when I run just them. So not sure what is going on there. If you also see this issue, please let me know what I changed or need to do to fix that issue.

If this is approved and merged, I would also like to go add similar features for add_a_ball to provide a different and shorter ball save feature.

Relates to 768 (set shoot_again to 0) and 1132. The wording is slightly inconsistent with ball_saves, but I didn't want to change it and break users configs. But might be worth doing (however that works) to ultimately have them be the same verbiage.

Added hurry up and grace period features to the multiball ball save.
This allows the user to run shows off the hurry up, as well as provide a
grace period for saves.
This allows the user to run shows off the hurry up, as well as provide a
grace period for saves.

The tests for test_Modes are failing when I run bulk, but run fine when I run just them.  So not sure what is going on there.  If you also see this issue, please let me know what I changed or need to do to fix that issue.

If this is approved and merged, I would also like to go add similar features for add_a_ball to provide a different and shorter ball save feature.
@jabdoa2
Copy link
Collaborator

jabdoa2 commented Aug 2, 2021

Tests fail because of this:

========

mpf/devices/multiball.py

Line: 147

pep257: D202 / No blank lines allowed after function docstring (found 1)

Line: 166

pep8: E128 / continuation line under-indented for visual indent (col 28)

pep8: E128 / continuation line under-indented for visual indent (col 28)

@atummons
Copy link
Contributor Author

atummons commented Aug 2, 2021

Jan, Thanks! I know see where those errors are located in Travis_CI, so I can fix them going forward. So everything passes now, but on my local it still fails the same 7 tests... Kinda weird. They all have the exact same stack trace. I've tried hunting, but can't seem to find it, and obviously is happening on my machine, but not in Travis. Thanks!

ERROR: test_ball_end (mpf.tests.test_Modes.TestModes)

Traceback (most recent call last):
File "c:\users\atummons\desktop\mpf\mpf\tests\MpfTestCase.py", line 548, in setUp
self._initialise_machine()
File "c:\users\atummons\desktop\mpf\mpf\tests\MpfTestCase.py", line 564, in _initialise_machine
self._wait_for_start(init, 20)
File "c:\users\atummons\desktop\mpf\mpf\tests\MpfTestCase.py", line 576, in _wait_for_start
init.result()
asyncio.base_futures.InvalidStateError: Result is not set.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\desktop\mpf\mpf\tests\MpfTestCase.py", line 557, in setUp
raise self._exception['exception']
File "C:\AppData\Local\Programs\Python\Python37\lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "c:\desktop\mpf\mpf\core\events.py", line 115, in _async_handler_done
future.result()
File "c:\desktop\mpf\mpf\core\mode_controller.py", line 119, in load_modes
self.machine.modes[mode] = self._load_mode(mode)
File "c:\desktop\mpf\mpf\core\mode_controller.py", line 157, in _load_mode
mode_class = self._load_mode_code(mode_string, config['mode']['code'])
File "c:\desktop\mpf\mpf\core\mode_controller.py", line 135, in _load_mode_code
return Util.string_to_class("modes.{}.code.{}".format(mode_string, code_path))
File "c:\desktop\mpf\mpf\core\utility_functions.py", line 608, in string_to_class
m = import(module)
ModuleNotFoundError: No module named 'modes.mode3'

@atummons atummons changed the title Added hurry up and grave period features to multiball ball save Adds hurry up and grace period features to multiball ball save Aug 2, 2021
@jabdoa2
Copy link
Collaborator

jabdoa2 commented Aug 8, 2021

Jan, Thanks! I know see where those errors are located in Travis_CI, so I can fix them going forward. So everything passes now, but on my local it still fails the same 7 tests... Kinda weird. They all have the exact same stack trace. I've tried hunting, but can't seem to find it, and obviously is happening on my machine, but not in Travis. Thanks!

ERROR: test_ball_end (mpf.tests.test_Modes.TestModes)

Traceback (most recent call last):
File "c:\users\atummons\desktop\mpf\mpf\tests\MpfTestCase.py", line 548, in setUp
self._initialise_machine()
File "c:\users\atummons\desktop\mpf\mpf\tests\MpfTestCase.py", line 564, in _initialise_machine
self._wait_for_start(init, 20)
File "c:\users\atummons\desktop\mpf\mpf\tests\MpfTestCase.py", line 576, in _wait_for_start
init.result()
asyncio.base_futures.InvalidStateError: Result is not set.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "c:\desktop\mpf\mpf\tests\MpfTestCase.py", line 557, in setUp
raise self._exception['exception']
File "C:\AppData\Local\Programs\Python\Python37\lib\asyncio\events.py", line 88, in _run
self._context.run(self._callback, *self._args)
File "c:\desktop\mpf\mpf\core\events.py", line 115, in _async_handler_done
future.result()
File "c:\desktop\mpf\mpf\core\mode_controller.py", line 119, in load_modes
self.machine.modes[mode] = self._load_mode(mode)
File "c:\desktop\mpf\mpf\core\mode_controller.py", line 157, in _load_mode
mode_class = self._load_mode_code(mode_string, config['mode']['code'])
File "c:\desktop\mpf\mpf\core\mode_controller.py", line 135, in _load_mode_code
return Util.string_to_class("modes.{}.code.{}".format(mode_string, code_path))
File "c:\desktop\mpf\mpf\core\utility_functions.py", line 608, in string_to_class
m = import(module)
ModuleNotFoundError: No module named 'modes.mode3'

Did you run the tests from inside the mpf folder? I think I fixed something similar recently. I think it needed some init.py (which should be optional in python 3 but that seems not to be always true). If CI is happy you at least did not make it worse ;-).

Copy link
Collaborator

@jabdoa2 jabdoa2 left a comment

Choose a reason for hiding this comment

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

Looks good overall. One small question regarding premature stop of the multiball (i.e. due to mode end).

mpf/devices/multiball.py Show resolved Hide resolved
mpf/devices/multiball.py Outdated Show resolved Hide resolved
Adds another test case to ensure that when grace period and hurry up are
not set, that they are never called in an event.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Aug 9, 2021

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Collaborator

@jabdoa2 jabdoa2 left a comment

Choose a reason for hiding this comment

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

Looks very good to me. Thanks for making all those changes.

@jabdoa2 jabdoa2 merged commit 356d8a4 into missionpinball:dev Aug 10, 2021
@atummons atummons deleted the MultiballBallSave branch August 28, 2021 23:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants