-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Added tests for environment checker and passive environment checker #2873
Added tests for environment checker and passive environment checker #2873
Conversation
… to fix bug if environment doesn't use np_random in reset
…n the opposite case than was intended to (openai#2871)" This reverts commit 519dfd9.
Can you add some tests to make sure this works now? Probably one test env which is deterministic (i.e. doesn't explicitly use RNG, but is implemented correctly), and one which forgets to call Also would be nice to have a more descriptive error message. Right now it's just an assertion error, so at the very least there should be a message as to what it tested directly, and ideally there should be some diagnosis (e.g. you probably forgot to call |
…ll warnings and errors
# Conflicts: # gym/utils/passive_env_checker.py
@RedTachyon So I have gone a bit overkill with your comment but I think it has helped find and improve the environment checker |
Following the discussion in #2885, I spotted a similar issue in and here |
Once fixed, there is no more undue warning with my env. |
…pening the wrong way around
Apologies, I thought that in the main env checker. That is now fixed in 28ba9ee |
# Conflicts: # gym/utils/env_checker.py # gym/utils/passive_env_checker.py # gym/wrappers/env_checker.py
…pec.py. Added tests for make keywords and improve existing tests
# Conflicts: # gym/envs/classic_control/cartpole.py # tests/envs/test_envs.py # tests/envs/test_registration.py # tests/wrappers/test_autoreset.py # tests/wrappers/test_order_enforcing.py # tests/wrappers/test_time_limit.py
This seems to be a combination of several different PRs at this point? Please try to keep different things separate, this will be very hard to review, and therefore will likely introduce new bugs. This PR should just focus on the env checker fixes and tests, separately there seem to be (1) typo fixes, (2) adding mujoco metadata, (3) plans to change dtype of discrete space samples, (4) an addition to the time limit wrapper, (5) some change in the dockerfile and setup, removing a dependency? (6) removing test_core.py (7) changes to many, many other tests I'd even go as far as to suggest that you make an effort to split this PR into these separate parts (more or less every bullet point should be a separate PR imo), as frustrating as that might be. Right now there's just so much stuff that's not been discussed tangled together in a single PR that it will cause new bugs. Each of those points will also need to be discussed in terms of "should we do it?", notably I don't see a good reason to remove test_core.py |
@RedTachyon I will try and get this to pass then I will close this PR and open a PR for each of the change ideas |
Closing this PR, for a number of new PRs that achieve all of the individual parts of this PR |
Some environments use Dict observations, which are not supported by the env_checker in the latest gym versions (0.24.0/1) The bug has been fixed in openai/gym#2873 but is yet to be released.
A number of issues have been found the environment checker and passive environment checker.
Due to the critical nature of this feature in gym with it being run on a majority of
gym.make
, this feature should have as minimal bugs as possible.This PR adds almost complete coverage of the respective functions ensuring that our environments pass while possible mistakes in environments do not.
Example bugs:
@LucasAlegre found that the invasive environment checker would raise an error if the environment did not use
np_random
duringreset
.@ttran2 integer rewards were not allowed #2878
Code changes:
reset(seed)
test_core.py
this seems largely unnecessary as all tests that more completely done in the rest of the projectTo do