mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 05:07:54 +00:00
Reverted Unrelated changes
This commit is contained in:
parent
31e3ff9efe
commit
242e9ed2ef
@ -2,27 +2,25 @@ import inspect
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
import pytest
|
|
||||||
|
|
||||||
# TODO: Get rid of this and use automatic discovery when Trick requires Python 2.7
|
# TODO: Get rid of this and use automatic discovery when Trick requires Python 2.7
|
||||||
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))), '..')))
|
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(inspect.getsourcefile(lambda:0))), '..')))
|
||||||
from variable_server import *
|
from variable_server import *
|
||||||
|
|
||||||
# @pytest.mark.variableserver
|
|
||||||
class TestVariableServer(unittest.TestCase):
|
class TestVariableServer(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.variable_server = VariableServer('localhost', 7000)
|
self.variable_server = VariableServer('localhost', 7000)
|
||||||
self.variables = [
|
self.variables = [
|
||||||
Variable('ball.state.input.position[0]', type_=int),
|
Variable('ball.obj.state.input.position[0]', type_=int),
|
||||||
Variable('ball.state.input.mass', units='g', type_=float)
|
Variable('ball.obj.state.input.mass', units='g', type_=float)
|
||||||
]
|
]
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
self.variable_server.close()
|
self.variable_server.close()
|
||||||
|
|
||||||
def test_get_value(self):
|
def test_get_value(self):
|
||||||
variable = 'ball.state.input.mass'
|
variable = 'ball.obj.state.input.mass'
|
||||||
|
|
||||||
self.assertEqual('10',
|
self.assertEqual('10',
|
||||||
self.variable_server.get_value(variable))
|
self.variable_server.get_value(variable))
|
||||||
@ -51,7 +49,7 @@ class TestVariableServer(unittest.TestCase):
|
|||||||
type_=dict)
|
type_=dict)
|
||||||
|
|
||||||
def test_set_value(self):
|
def test_set_value(self):
|
||||||
variable = 'ball.state.input.position[1]'
|
variable = 'ball.obj.state.input.position[1]'
|
||||||
self.variable_server.set_value(variable, 1337)
|
self.variable_server.set_value(variable, 1337)
|
||||||
self.assertEqual('1337', self.variable_server.get_value(variable))
|
self.assertEqual('1337', self.variable_server.get_value(variable))
|
||||||
self.variable_server.set_value(variable, 1337, 'km')
|
self.variable_server.set_value(variable, 1337, 'km')
|
||||||
@ -81,13 +79,13 @@ class TestVariableServer(unittest.TestCase):
|
|||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
UnitsConversionError,
|
UnitsConversionError,
|
||||||
self.variable_server.add_variables,
|
self.variable_server.add_variables,
|
||||||
Variable('ball.state.input.mass', units='fjarnskaggl'))
|
Variable('ball.obj.state.input.mass', units='fjarnskaggl'))
|
||||||
|
|
||||||
# bad type
|
# bad type
|
||||||
self.assertRaises(
|
self.assertRaises(
|
||||||
ValueError,
|
ValueError,
|
||||||
self.variable_server.add_variables,
|
self.variable_server.add_variables,
|
||||||
Variable('ball.state.input.mass', type_=dict))
|
Variable('ball.obj.state.input.mass', type_=dict))
|
||||||
|
|
||||||
|
|
||||||
def test_remove_variables(self):
|
def test_remove_variables(self):
|
||||||
|
@ -15,6 +15,3 @@ trick.add_read(read, "trick.ball_print(ball.state)")
|
|||||||
# Set the stop time
|
# Set the stop time
|
||||||
trick.exec_set_terminate_time(300.0)
|
trick.exec_set_terminate_time(300.0)
|
||||||
|
|
||||||
trick.var_server_set_port(7000)
|
|
||||||
trick.exec_set_freeze_command(True)
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user