Closed EdHurtig closed 6 years ago
Each test in tests/integration will have the same redundant code in it as stands. This redundant code should be DRY'd up
tests/integration
Redundancy is in the setup and tear down
import os import time import unittest from hyperloop import ControllerInstance PATHS = [ os.environ.get("CORE_LOCATION", None), "../../proj/BUILD/dst/usr/local/bin/core", "../../proj/core/core", "./BUILD/dst/usr/local/bin/core", "./proj/BUILD/dst/usr/local/bin/core", "./proj/core/core", ] CONTROLLER_PATH = None for path in PATHS: if path and os.path.exists(path): CONTROLLER_PATH = path break class TestFlightProfiles(unittest.TestCase): def setUp(self): if CONTROLLER_PATH is None: self.fail("Could not find core: ".format(PATHS)) self.controller = ControllerInstance(CONTROLLER_PATH, imu="-", POST=True) self.assertTrue(self.controller.start()) def tearDown(self): self.controller.shutdown()
Notably, the PATHS list to discover the binary really needs to be in a single place as it will certainly change in the future
PATHS
Each test in
tests/integration
will have the same redundant code in it as stands. This redundant code should be DRY'd upRedundancy is in the setup and tear down
Notably, the
PATHS
list to discover the binary really needs to be in a single place as it will certainly change in the future