docstr: We want to avoid random errors while database got reset - those
  Are apparently triggered by parser trying to parse DAGs while
  The tables are dropped. We move the dags temporarily out of the dags folder
  and move them back after reset.
  
  We also remove all logs from logs directory to have a clear log state and see only logs from this
  test.
docstr_tok: ["We","want","to","avoid","random","errors","while","database","got","reset","-","those","Are","apparently","triggered","by","parser","trying","to","parse","DAGs","while","The","tables","are","dropped",".","We","move","the","dags","temporarily","out","of","the","dags","folder","and","move","them","back","after","reset",".","We","also","remove","all","logs","from","logs","directory","to","have","a","clear","log","state","and","see","only","logs","from","this","test","."]
code: def setup_system(self):
      """
      We want to avoid random errors while database got reset - those
      Are apparently triggered by parser trying to parse DAGs while
      The tables are dropped. We move the dags temporarily out of the dags folder
      and move them back after reset.
  
      We also remove all logs from logs directory to have a clear log state and see only logs from this
      test.
      """
      print()
      print("Removing all log files except previous_runs")
      print()
      logs_folder = resolve_logs_folder()
      files = os.listdir(logs_folder)
      for file in files:
          file_path = os.path.join(logs_folder, file)
          if os.path.isfile(file_path):
              os.remove(file_path)
          elif os.path.isdir(file) and file != "previous_runs":
              shutil.rmtree(file_path, ignore_errors=True)
      yield
      #  We save the logs to a separate directory so that we can see them later.
      date_str = datetime.now().strftime("%Y-%m-%d_%H_%M_%S")
      logs_folder = resolve_logs_folder()
      print()
      print(
          f"Saving all log files to {logs_folder}/previous_runs/{date_str}"
      )
      print()
      target_dir = os.path.join(logs_folder, "previous_runs", date_str)
      Path(target_dir).mkdir(parents=True, exist_ok=True, mode=0o755)
      files = os.listdir(logs_folder)
      for file in files:
          if file != "previous_runs":
              file_path = os.path.join(logs_folder, file)
              shutil.move(file_path, target_dir)
  
imports: from __future__ import annotations
  import contextlib
  import logging
  import os
  import shutil
  from datetime import datetime
  from pathlib import Path
  import pytest
  from airflow.configuration import AIRFLOW_HOME, AirflowConfigParser, get_airflow_config
  from airflow.exceptions import AirflowException
  from airflow.models.dagbag import DagBag
  from tests.test_utils import AIRFLOW_MAIN_FOLDER
  from tests.test_utils.logging_command_executor import get_executor
label_desc: Use image node_id 2 for calling the SystemTest obj's underlying member method code with example usage: obj.setup_system() without return types