Browse Source

Merge branch 'pytest_warns' into newstep

saleml 2 năm trước cách đây
mục cha
commit
0ee22f1f92
1 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 5 4
      tests/test_envs.py

+ 5 - 4
tests/test_envs.py

@@ -1,3 +1,5 @@
+import warnings
+
 import gym
 import numpy as np
 import pytest
@@ -25,13 +27,12 @@ CHECK_ENV_IGNORE_WARNINGS = [
 )
 def test_env(spec):
     # Capture warnings
-    env = spec.make(disable_env_checker=True, new_step_api=True).unwrapped
+    env = spec.make(disable_env_checker=True).unwrapped
 
     # Test if env adheres to Gym API
-    with pytest.warns() as warnings:
+    with warnings.catch_warnings(record=True) as w:
         check_env(env)
-
-    for warning in warnings.list:
+    for warning in w:
         if warning.message.args[0] not in CHECK_ENV_IGNORE_WARNINGS:
             raise gym.error.Error(f"Unexpected warning: {warning.message}")