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

Wrappers doctests #1083

Merged
merged 28 commits into from
Sep 4, 2023
Merged

Conversation

elliottower
Copy link
Contributor

@elliottower elliottower commented Sep 1, 2023

Description

This PR adds testing to ensure that all of the examples used in our documentation work correctly as intended.

The workflow even complies the environment MD pages, and runs tests on those--which allows us to validate that every single usage example shown on the website will run without errors (the script also ensures that the same base usage_aec and usage_parallel skeletons are used for each env page, so things are easier to maintain and keep consistent). Previously the script was impossible to test with pytest as they were markdown files embedded, but this solves that problem.

In doing these checks, I uncovered a wide variety of other issues which I then fixed (maybe not ideal to put them in the same PR, but I'm limited in bandwidth so this is the best I can do currently).

One such change is adding assertions to each of the PettingZoo included wrappers to ensure that they are only used on AECEnvs, as they inherit the base env class and are not functionally able to handle parallel envs, but it was still possible to wrap parallel envs--with incorrect behavior. I would like to make the wrappers work with both envs in the future, but the code as is currently does not.

Edit:
I have also included a yml formatter pre commit hook, and added some functionality for using pytest split and saving durations for the docs tests because they run quite slowly.

TODO for the future:

  • See if it's possible to get faster speed manually creating a shell script to parse through all of the documentation and get the python snippets and run them that way. Probably not worth the effort though if we can get the pytest split durations working.
    Fixes # (issue), Depends on # (pull request)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Screenshots

Please attach before and after screenshots of the change if applicable.
To upload images to a PR -- simply drag and drop or copy paste.

Checklist:

  • I have run the pre-commit checks with pre-commit run --all-files (see CONTRIBUTING.md instructions to set it up)
  • I have run pytest -v and no errors are present.
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I solved any possible warnings that pytest -v has generated that are related to my code to the best of my knowledge.
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@elliottower elliottower merged commit e5f03f7 into Farama-Foundation:master Sep 4, 2023
@elliottower elliottower deleted the wrappers-doctests branch September 4, 2023 05:15
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