#!/usr/bin/env python1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2# Copyright (C) 2016-2026 German Aerospace Center (DLR) and others.3# This program and the accompanying materials are made available under the4# terms of the Eclipse Public License 2.0 which is available at5# https://www.eclipse.org/legal/epl-2.0/6# This Source Code may also be made available under the following Secondary7# Licenses when the conditions for such availability set forth in the Eclipse8# Public License 2.0 are satisfied: GNU General Public License, version 29# or later which is available at10# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later1213# @file runner.py14# @author Michael Behrisch15# @date 2019-01-091617from __future__ import absolute_import18from __future__ import print_function1920import sys21import os22import unittest2324# Do not use SUMO_HOME here to ensure you are always testing the25# functions from the same tree the test is in26sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'tools'))2728import sumolib # noqa293031class Test_Init(unittest.TestCase):3233def test_checkBinary(self):34self.assertEqual(os.environ['SUMO_BINARY'], sumolib.checkBinary('sumo'))35del os.environ['SUMO_BINARY']36self.assertIn('sumo', sumolib.checkBinary('sumo'))37del os.environ['SUMO_HOME']38try:39# try whether the eclipse-sumo wheel is installed40import sumo # noqa41self.assertIn('sumo', sumolib.checkBinary('sumo'))42self.assertIn('python', sumolib.checkBinary('sumo').lower())43except ImportError:44self.assertEqual('sumo', sumolib.checkBinary('sumo', ''))4546def test_intTime(self):47self.assertEqual(1, sumolib._intTime('1.0'))48self.assertEqual(1, sumolib._intTime('1.1'))49self.assertEqual(1, sumolib._intTime('1.9'))505152if __name__ == '__main__':53unittest.main()545556