Skip to content

Commit

Permalink
Merge branch 'master' of github.com:leigh-johnson/gym-donkeycar
Browse files Browse the repository at this point in the history
  • Loading branch information
leigh-johnson committed Aug 4, 2019
2 parents 875f1e1 + 8e69709 commit 96f3e19
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
5 changes: 3 additions & 2 deletions gym_donkeycar/envs/donkey_sim.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def __init__(self, level, time_step=0.05, hostname='0.0.0.0',
self.address = (hostname, port)

self.handler = DonkeyUnitySimHandler(
level, time_step=time_step, max_cte=max_cte, verbose=verbose, cam_resolution=cam_resolution)

level, time_step=time_step, max_cte=max_cte, cam_resolution=cam_resolution)

import pdb; pdb.set_trace()
try:
self.server = SimServer(self.address, self.handler)
except OSError:
Expand Down
30 changes: 19 additions & 11 deletions tests/test_gym_donkeycar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,28 @@

"""Tests for `gym_donkeycar` package."""

import os
import pytest

import gym
import gym_donkeycar.envs

@pytest.fixture
def response():
"""Sample pytest fixture.
env_list = [
"donkey-warehouse-v0",
"donkey-generated-roads-v0",
"donkey-avc-sparkfun-v0",
"donkey-generated-track-v0"
]

See more at: http://doc.pytest.org/en/latest/fixture.html
"""
# import requests
# return requests.get('https://github.com/audreyr/cookiecutter-pypackage')
def test_load_gyms(mocker):
sim_ctl = mocker.patch('gym_donkeycar.envs.donkey_env.DonkeyUnitySimContoller')
unity_proc = mocker.patch('gym_donkeycar.envs.donkey_env.DonkeyUnityProcess')

for i, gym_name in enumerate(env_list):

env = gym.make(gym_name)
assert env.ACTION_NAMES == ['steer', 'throttle']
assert env.spec.id == gym_name
assert sim_ctl.call_count == i+1
assert unity_proc.call_count == i+1

def test_content(response):
"""Sample pytest test function with the pytest fixture as an argument."""
# from bs4 import BeautifulSoup
# assert 'GitHub' in BeautifulSoup(response.content).title.string

0 comments on commit 96f3e19

Please sign in to comment.