Skip to content

Commit

Permalink
Fix some issues
Browse files Browse the repository at this point in the history
  • Loading branch information
iav-DaBi committed Dec 2, 2024
1 parent 3b49d40 commit 2b856b9
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: ./.github/actions/setup
- name: Run fast tests itself with pytest
run: |
pipenv run pytest -m 'not skip_ci and not slow' test
pipenv run pytest -m 'not skip_ci and not slow and not one_anki_car_needed' test
pytest-testing-slow:
name: Run slow tests with pytest
Expand Down
2 changes: 1 addition & 1 deletion src/UserInterface/DriverUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from DataModel.Vehicle import Vehicle
from EnvironmentManagement.EnvironmentManager import EnvironmentManager
from EnvironmentManagement.ConfigurationHandler import ConfigurationHandler
from VehicleMovementManagement import BehaviourController
from VehicleMovementManagement.BehaviourController import BehaviourController

logger = logging.getLogger(__name__)

Expand Down
14 changes: 7 additions & 7 deletions test/UnitTest/DataModel/Vehicle_Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from DataModel.Vehicle import Vehicle
from Items.Item import Item
from LocationService.LocationService import LocationService
from VehicleManagement.VehicleController import VehicleController
from VehicleManagement.FleetController import FleetController

dummy_uuid = "FA:14:67:0F:39:FE"
Expand All @@ -22,18 +21,19 @@ def init_vehicle():


@pytest.mark.one_anki_car_needed
def test_get_location():
vctrl = VehicleController()
@pytest.mark.asyncio
async def test_get_location():
loc_Service = LocationService(None)
fleet_ctrl = FleetController()

found_vehicles = fleet_ctrl.scan_for_anki_cars()
mut = Vehicle(found_vehicles[0], vctrl)
found_vehicles = await fleet_ctrl.scan_for_anki_cars()
mut = Vehicle(found_vehicles[0], loc_Service)

mut.speed_request = 80.0
mut.request_speed_percent(80.0)

sleep(5)

mut.speed_request = 0.0
mut.request_speed_percent(0.0)

assert mut

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def get_mut_with_one_minute_playing_time(initialise_dependencies) -> Environment
fleet_ctrl_mock, configuration_handler_mock = initialise_dependencies
configuration_handler_mock.get_configuration.return_value = {
"virtual_cars_pics": {"AB:CD:EF:12:34:56": "ABCDEF123456.svg",
"GH:IJ:KL:78:90:21": "GHIJKL789021.svg"},
"GH:IJ:KL:78:90:21": "GHIJKL789021.svg"},
"driver": {"key1": "value1", "key2": "value2"},
"game_config": {"game_cfg_playing_time_limit_min": 1}}

Expand All @@ -42,7 +42,7 @@ def get_mut_with_endless_playing_time(initialise_dependencies) -> EnvironmentMan

configuration_handler_mock.get_configuration.return_value = {
"virtual_cars_pics": {"AB:CD:EF:12:34:56": "ABCDEF123456.svg",
"GH:IJ:KL:78:90:21": "GHIJKL789021.svg"},
"GH:IJ:KL:78:90:21": "GHIJKL789021.svg"},
"driver": {"key1": "value1", "key2": "value2"},
"game_config": {"game_cfg_playing_time_limit_min": 0}}

Expand Down
7 changes: 5 additions & 2 deletions test/UnitTest/UserInterface/DriverUI_Test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,11 @@ def initialise_dependencies():
Prepare a DriverUI, Environment Vehicle and Vehicle
"""
configuration_handler_mock = MagicMock(spec=ConfigurationHandler)
configuration_handler_mock.get_configuration.return_value = \
{"game_config": {"game_cfg_playing_time_limit_min": 0}}
configuration_handler_mock.get_configuration.return_value = {
"virtual_cars_pics": {"AB:CD:EF:12:34:56": "ABCDEF123456.svg",
"GH:IJ:KL:78:90:21": "GHIJKL789021.svg"},
"driver": {"key1": "value1", "key2": "value2"},
"game_config": {"game_cfg_playing_time_limit_min": 0}}

socket = AsyncServer(async_mode='asgi')
fleet_ctrl = FleetController()
Expand Down

0 comments on commit 2b856b9

Please sign in to comment.