class_docstr: Setup global variables and storage for tests.
  
  It generates a new storage configuration and swaps it,
  the previous configuration is restored after the test.
  It also initializes PickleDB as the storage for testing.
  We use PickledDB as our storage mock
  
  Parameters
  ----------
  benchmarks: List, optional
     List of benchmarks to insert into the database
  experiments: list, optional
      List of experiments to insert into the database
  trials: list, optional
      List of trials to insert into the database
  workers: list, optional
      List of workers to insert into the database
  lies: list, optional
      List of lies to insert into the database
  resources: list, optional
      List of resources to insert into the database
  from_yaml: YAML, optional
      YAML config to apply for this test
  storage: dict, optional
      Configuration of the underlying storage backend
  
  Examples
  --------
  >>> my_config = {...}
  >>> with OrionState(my_config):
      ...
class_docstr_tok: ["Setup","global","variables","and","storage","for","tests",".","It","generates","a","new","storage","configuration","and","swaps","it",",","the","previous","configuration","is","restored","after","the","test",".","It","also","initializes","PickleDB","as","the","storage","for","testing",".","We","use","PickledDB","as","our","storage","mock","Parameters","--","--","--","--","--","benchmarks",":","List",",","optional","List","of","benchmarks","to","insert","into","the","database","experiments",":","list",",","optional","List","of","experiments","to","insert","into","the","database","trials",":","list",",","optional","List","of","trials","to","insert","into","the","database","workers",":","list",",","optional","List","of","workers","to","insert","into","the","database","lies",":","list",",","optional","List","of","lies","to","insert","into","the","database","resources",":","list",",","optional","List","of","resources","to","insert","into","the","database","from_yaml",":","YAML",",","optional","YAML","config","to","apply","for","this","test","storage",":","dict",",","optional","Configuration","of","the","underlying","storage","backend","Examples","--","--","--","--",">",">",">","my_config","=","{","...","}",">",">",">","with","OrionState","(","my_config",")",":","..."]
code: def __init__(
      self,
      benchmarks=None,
      experiments=None,
      trials=None,
      workers=None,
      lies=None,
      resources=None,
      from_yaml=None,
      storage=None,
  ):
      if from_yaml is not None:
          with open(from_yaml) as f:
              exp_config = list(yaml.safe_load_all(f))
              experiments = exp_config[0]
              trials = exp_config[1]
  
      self.tempfile = None
      self.tempfile_path = None
  
      self.previous_config = copy.deepcopy(
          orion.core.config.storage.to_dict()
      )
      self.storage_config = _select(
          storage, _get_default_test_storage()
      )
      self.storage = None
  
      self._benchmarks = _select(benchmarks, [])
      self._experiments = _select(experiments, [])
      self._trials = _select(trials, [])
      self._workers = _select(workers, [])
      self._resources = _select(resources, [])
      self._lies = _select(lies, [])
  
      # In case of track we also store the inserted object
      # so the user can compare in tests the different values
      self.trials = []
      self.experiments = self._experiments
      self.lies = []
  
imports: import copy
  import os
  import tempfile
  import yaml
  import orion
  from orion.core.io import experiment_builder
  from orion.core.worker.trial import Trial
  from orion.storage.base import setup_storage, storage_factory
label_desc: Use image node_id 1 to create a new BaseOrionState object  with example: obj = BaseOrionState(benchmarks, experiments, trials, workers, lies, resources, from_yaml, storage)