code: def test_stress_unique_folder_creation(
      storage, monkeypatch, tmpdir, capfd
  ):
      """Test integration with a possible framework that needs to create
      unique directories per trial.
      """
      # XXX: return and complete test when there is a way to control random
      # seed of Oríon
      how_many = 2
      monkeypatch.chdir(os.path.dirname(os.path.abspath(__file__)))
      orion.core.cli.main(
          [
              "-vvv",
              "hunt",
              f"--max-trials={how_many}",
              "--name=lalala",
              "--config",
              "./stress_gradient.yaml",
              "./dir_per_trial.py",
              f"--dir={str(tmpdir)}",
              "--other-name",
              "{exp.name}",
              "--name",
              "{trial.hash_name}",
              "-x~gaussian(30, 10)",
          ]
      )
  
      exp = list(storage.fetch_experiments({"name": "lalala"}))
      assert len(exp) == 1
      exp = exp[0]
      assert "_id" in exp
      exp_id = exp["_id"]
  
      # For contingent broken trials, which in this test means that a existing
      # directory was attempted to be created, it means that it's not md5 or
      # bad hash creation to blame, but the finite precision of the floating
      # point representation. Specifically, it seems that gradient descent
      # is able to reach such levels of precision jumping around the minimum
      # (notice that an appropriate learning rate was selected in this stress
      # test to create underdamped behaviour), that it begins to suggest same
      # things from the past. This is intended to be shown with the assertions
      # in the for-loop below.
      trials_c = list(
          storage.fetch_trials(
              uid=exp_id, where={"status": "completed"}
          )
      )
      list_of_cx = [trial.params["/x"] for trial in trials_c]
      trials_b = list(
          storage.fetch_trials(uid=exp_id, where={"status": "broken"})
      )
      list_of_bx = [trial.params["/x"] for trial in trials_b]
      for bx in list_of_bx:
          assert bx in list_of_cx
  
      # ``exp.name`` has been delivered correctly (next 2 assertions)
      assert len(os.listdir(str(tmpdir))) == 1
      # Also, because of the way the demo gradient descent works `how_many` trials
      # can be completed
      assert len(os.listdir(str(tmpdir.join("lalala")))) == how_many
      assert len(trials_c) == how_many
      capfd.readouterr()
  
imports: import os
  import shutil
  import subprocess
  import sys
  import tempfile
  from collections import defaultdict
  from contextlib import contextmanager
  import numpy
  import pytest
  import yaml
  import orion.core.cli
  import orion.core.io.experiment_builder
  from orion.core.cli.hunt import workon
  from orion.testing import OrionState
label_desc: Use image node_id 11 for calling a global function with example usage: test_stress_unique_folder_creation(storage, monkeypatch, tmpdir, capfd) without return types