Skip to content

Commit

Permalink
✅ Make test_requirements_graph quiet
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathïs Fédérico committed Jan 22, 2024
1 parent 548a923 commit 99fbe63
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/examples/test_common.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from pathlib import Path
from time import sleep
from typing import Type

import pytest
import pytest_check as check
from pytest_mock import MockerFixture

import os

Expand Down Expand Up @@ -98,7 +99,7 @@ def test_gym_make(env_gym_id):

@pytest.mark.slow
@pytest.mark.parametrize("env_class", EXAMPLE_ENVS)
def test_requirements_graph(env_class: Type[HcraftEnv]):
def test_requirements_graph(env_class: Type[HcraftEnv], mocker: MockerFixture):
draw_plt = True
draw_html = True
save = False
Expand Down Expand Up @@ -126,10 +127,9 @@ def test_requirements_graph(env_class: Type[HcraftEnv]):
plt.close()

if draw_html:
mocker.patch("pyvis.network.webbrowser.open")
requirements_dir.mkdir(exist_ok=True)
filepath = requirements_dir / f"{env.name}_requirements_graph.html"
exists = filepath.exists()
if not save:
mocker.patch("pyvis.network.Network.write_html")
requirements.draw(engine="pyvis", save_path=filepath)
if not save and not exists:
sleep(0.2)
os.remove(filepath)

0 comments on commit 99fbe63

Please sign in to comment.