Missing warnings with pytest --forked option
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- testing-qa
Línea de trabajo
Reproduce la discrepancia con los dos comandos de Docker del issue, comparando pytest --forked con pytest sin --forked. Rastrea cómo pytest-forked gestiona las advertencias de los tests ejecutados mediante fork; se considera terminado cuando las advertencias se informan de forma coherente, en lugar de perder las aproximadamente 1.500 advertencias que se muestran en la ejecución sin fork.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi,
I found out in https://github.com/openai/gym/issues/2647 that the pytest --forked option seems to miss to report many warnings.
With the --forked option I get only 2 warnings:
❯ docker run gym-docker pytest --forked --import-mode=append
[...]
============================= test session starts ==============================
platform linux -- Python 3.10.2, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /usr/local/gym
plugins: forked-1.4.0
collected 623 items / 5 skipped / 618 selected
[...]
=============================== warnings summary ===============================
../lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py:9
/usr/local/lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py:9: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
import distutils.spawn
../lib/python3.10/site-packages/gym/spaces/box.py:78
/usr/local/lib/python3.10/site-packages/gym/spaces/box.py:78: UserWarning: WARN: Box bound precision lowered by casting to float32
logger.warn(f"Box bound precision lowered by casting to {self.dtype}")
-- Docs: https://docs.pytest.org/en/stable/warnings.html
================= 621 passed, 7 skipped, 2 warnings in 39.42s ==================
Now without the --forked option I get ~1500 warnings:
❯ docker run gym-docker pytest --import-mode=append
[...]
============================= test session starts ==============================
platform linux -- Python 3.10.2, pytest-6.2.5, py-1.11.0, pluggy-1.0.0
rootdir: /usr/local/gym
plugins: forked-1.4.0
collected 623 items / 5 skipped / 618 selected
[...]
=============================== warnings summary ===============================
../lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py:9
/usr/local/lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py:9: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
import distutils.spawn
../lib/python3.10/site-packages/gym/spaces/box.py:78
tests/wrappers/test_normalize.py::test_normalize_observation[False]
tests/wrappers/test_normalize.py::test_normalize_observation[True]
tests/wrappers/test_normalize.py::test_normalize_reset_info
tests/wrappers/test_normalize.py::test_normalize_return
tests/wrappers/test_normalize.py::test_normalize_observation_vector_env
tests/wrappers/test_normalize.py::test_normalize_return_vector_env
/usr/local/lib/python3.10/site-packages/gym/spaces/box.py:78: UserWarning: WARN: Box bound precision lowered by casting to float32
logger.warn(f"Box bound precision lowered by casting to {self.dtype}")
tests/envs/test_determinism.py: 80 warnings
tests/envs/test_envs.py: 137 warnings
tests/spaces/test_spaces.py: 266 warnings
tests/spaces/test_utils.py: 176 warnings
tests/utils/test_env_checker.py: 2 warnings
tests/vector/test_async_vector_env.py: 16 warnings
tests/vector/test_numpy_utils.py: 64 warnings
tests/vector/test_shared_memory.py: 128 warnings
tests/vector/test_sync_vector_env.py: 8 warnings
tests/wrappers/test_normalize.py: 6 warnings
tests/wrappers/test_record_episode_statistics.py: 181 warnings
tests/wrappers/test_record_video.py: 398 warnings
tests/wrappers/test_time_aware_observation.py: 2 warnings
tests/wrappers/test_transform_observation.py: 1 warning
tests/wrappers/test_transform_reward.py: 14 warnings
/usr/local/lib/python3.10/site-packages/gym/utils/seeding.py:47: DeprecationWarning: WARN: Function `rng.randint(low, [high, size, dtype])` is marked as deprecated and will be removed in the future. Please use `rng.integers(low, [high, size, dtype])` instead.
deprecation(
tests/envs/test_envs.py::test_env[spec1]
tests/envs/test_envs.py::test_env[spec2]
tests/envs/test_envs.py::test_env[spec10]
tests/envs/test_envs.py::test_env[spec11]
/usr/local/lib/python3.10/site-packages/gym/utils/env_checker.py:116: UserWarning: WARN: Agent's minimum observation space value is -infinity. This is probably too low.
logger.warn(
tests/envs/test_envs.py::test_env[spec1]
tests/envs/test_envs.py::test_env[spec2]
tests/envs/test_envs.py::test_env[spec10]
tests/envs/test_envs.py::test_env[spec11]
/usr/local/lib/python3.10/site-packages/gym/utils/env_checker.py:120: UserWarning: WARN: Agent's maxmimum observation space value is infinity. This is probably too high
logger.warn(
tests/envs/test_envs.py::test_env[spec4]
tests/envs/test_envs.py::test_env[spec14]
/usr/local/lib/python3.10/site-packages/gym/utils/env_checker.py:162: UserWarning: WARN: We recommend you to use a symmetric and normalized Box action space (range=[-1, 1]) cf https://stable-baselines3.readthedocs.io/en/master/guide/rl_tips.html
logger.warn(
tests/envs/test_envs.py::test_env[spec14]
tests/envs/test_envs.py::test_env[spec14]
tests/envs/test_envs.py::test_env[spec14]
tests/envs/test_envs.py::test_env[spec14]
/usr/local/lib/python3.10/site-packages/gym/envs/classic_control/pendulum.py:183: DeprecationWarning: In future, it will be an error for 'np.bool_' scalars to be interpreted as an index
scale_img = pygame.transform.flip(scale_img, is_flip, True)
tests/spaces/test_spaces.py::test_box_dtype_check
tests/vector/test_spaces.py::test_iterate[Box0]
tests/vector/test_spaces.py::test_iterate[Box4]
tests/vector/test_spaces.py::test_iterate[Dict1]
tests/vector/test_spaces.py::test_iterate_custom_space[Tuple]
/usr/local/lib/python3.10/site-packages/gym/spaces/box.py:153: UserWarning: WARN: Casting input x to numpy array. logger.warn("Casting input x to numpy array.")
tests/vector/test_async_vector_env.py::test_custom_space_async_vector_env_shared_memory
/usr/local/lib/python3.10/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function AsyncVectorEnv.__del__ at 0x7f0366be9ea0>
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gym/vector/async_vector_env.py", line 631, in __del__
self.close(terminate=True)
File "/usr/local/lib/python3.10/site-packages/gym/vector/vector_env.py", line 193, in close
self.close_extras(**kwargs)
File "/usr/local/lib/python3.10/site-packages/gym/vector/async_vector_env.py", line 543, in close_extras
if self._state != AsyncState.DEFAULT:
AttributeError: 'AsyncVectorEnv' object has no attribute '_state'
warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
tests/wrappers/test_record_video.py::test_record_video_reset_return_info
/usr/local/lib/python3.10/site-packages/_pytest/unraisableexception.py:78: PytestUnraisableExceptionWarning: Exception ignored in: <function VideoRecorder.__del__ at 0x7f0366c06b90>
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py", line 193, in __del__
self.close()
File "/usr/local/lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py", line 182, in close
self.write_metadata()
File "/usr/local/lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py", line 188, in write_metadata
with open(self.metadata_path, "w") as f:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/gym/videos/rl-video-step-0.meta.json'
warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
tests/wrappers/test_video_recorder.py::test_record_breaking_render_method
/usr/local/lib/python3.10/site-packages/gym/wrappers/monitoring/video_recorder.py:136: UserWarning: WARN: Env returned None on render(). Disabling further rendering for video recorder by marking as disabled: path=/tmp/tmpqrycjchl.mp4 metadata_path=/tmp/tmpqrycjchl.meta.json
logger.warn(
-- Docs: https://docs.pytest.org/en/stable/warnings.html
================ 621 passed, 7 skipped, 1509 warnings in 21.03s ================
Steps to reproduce:
git clone [email protected]:openai/gym.git
cd gym
wget https://www.roboti.us/file/mjkey.txt
docker build -f py.Dockerfile --build-arg MUJOCO_KEY=./mjkey.txt --build-arg PYTHON_VERSION=3.10 --tag gym-docker .
Then run either docker run gym-docker pytest --forked --import-mode=append or docker run gym-docker pytest --import-mode=append
Let me know if I can do anything else to help troubleshoot!
- Lenguaje dominante
- Python
- Estrellas
- 83
- Forks
- 29
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Aún no hemos revisado los archivos de configuración de este proyecto. Empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pytest-dev/pytest-forked
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pytest-dev/pytest-forked#106 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
pytest-dev/pytest-forked#84 ·
-
Fork per subpathAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
pytest-dev/pytest-forked#94 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
pytest-dev/pytest-forked#88 · 12 comentarios ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
pytest-dev/pytest-forked#87 · 1 reacción ·
Todos los issues de pytest-dev/pytest-forked
Issues similares
-
customer-reported
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Azure/azure-cli#34150 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
community-request
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
NVIDIA-NeMo/Curator#2464 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
weblate-discover crashes with an unhandled FileNotFoundError when the directory does not existAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
WeblateOrg/translation-finder#1099 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
trezor/trezor-firmware#7997 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día