Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
l8556 committed Sep 12, 2024
1 parent ff3f810 commit 2cbebc5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

from frameworks.decorators import vm_is_turn_on
from .vm_data import VmData
from ..configs import VmConfig
from tests.desktop_tests.tools.configs import VmConfig


class VboxMachine:

def __init__(self, name: str):
self.vm_config = VmConfig()
def __init__(self, name: str, config_path: str = None):
self.vm_config = VmConfig(config_path=config_path)
self.vm = VirtualMachine(name)
self.name = name
self.data = None
Expand Down
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions frameworks/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
from .VboxMachine import VboxMachine
from console import MyConsole
from .decorators import vm_data_created, vm_is_turn_on, retry
from .report import Report

__all__ = [VboxMachine, MyConsole, Report, 'vm_data_created', 'vm_is_turn_on', 'retry']
8 changes: 4 additions & 4 deletions tests/desktop_tests/tools/test_tools.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
# -*- coding: utf-8 -*-
import signal
from os import getcwd
from os.path import join, dirname, isfile
from typing import Optional

from VBoxWrapper import VirtualMachinException
from frameworks.console import MyConsole
from frameworks.decorators import retry, vm_data_created
from host_tools import File, Dir
from ssh_wrapper import Ssh, Sftp, ServerData

from .VboxMachine import VboxMachine
from frameworks import VboxMachine, MyConsole, retry, vm_data_created
from .desktop_report import DesktopReport
from .paths import Paths
from .ssh_connection import SSHConnection
Expand All @@ -28,11 +27,12 @@ def handle_interrupt(signum, frame):


class TestTools:
vm_config_path = join(getcwd(), "vm_configs", "desktop_test_vm_config.json")

def __init__(self, vm_name: str, test_data: TestData):
self.data = test_data
self.vm_name = vm_name
self.vm = VboxMachine(self.vm_name)
self.vm = VboxMachine(self.vm_name, config_path=self.vm_config_path)
self.password_cache = None

self._initialize_report()
Expand Down
File renamed without changes.

0 comments on commit 2cbebc5

Please sign in to comment.