소스 검색

Merge branch 'pytest_warns' into newstep

saleml 2 년 전
부모
커밋
0ee22f1f92
1개의 변경된 파일5개의 추가작업 그리고 4개의 파일을 삭제
  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}")