andreped / super-ml-pets

🐢 AI for Super Auto Pets
MIT License
31 stars 13 forks source link

Add unit tests for deployment #49

Closed andreped closed 1 year ago

andreped commented 1 year ago

Right now we have added a test CI for verifying that training works as intended.

For deployment this is more challenging to do as we cannot directly play the game from a CI.

Hence, a suggestion could be to setup a simple virtual play session, where we have screenshots to enable the AI to interact.

Might be that it crashes anyways, but at least we can verify that some of the deployment functionalities works.

andreped commented 1 year ago

Might be a good idea to test part of the deployment functionality without the visual system.

For instance, during a sell event, when attempting to sell a pet at a specific location, we could check that the team has lost a member (team length reduced by 1), as well as check that the removed element is actually empty after removal.

andreped commented 1 year ago

Added some unit tests in 6808de97b5df12c7c7058e062efa6fdfe3608959.

However, pyautogui does not seem to work as expected on a headless machine, as we have when running the codecov CI.

andreped commented 1 year ago

Got further. Introduced a virtual display in 5ea597a54e8e3914899e3e35e94638405b503491.

But it seems to deadlock during tests. Not sure why.

andreped commented 1 year ago

Fixed on 34bcd3d9186ed0139bf1e3ef24528cabe301e01c.

It remains to have a test environment for the actual game, but at least we can run tests with pyautogui with a virtual screen.