import os import unittest from pprint import pprint import click from flexmock import flexmock, flexmock_teardown from Test.testingUtils import restore_test_resources from libs.CompilerUploader import CompilerUploader, CompilerException from libs.LoggingUtils import init_logging from libs.PathsManager import PathsManager as pm from libs.utils import is_windows, is_linux, is_mac log = init_logging(__name__) class TestCompilerUploader(unittest.TestCase): platform_to_use = None portToUse = None @classmethod def setUpClass(cls): if cls.portToUse is None: try: cls.portToUse = CompilerUploader.construct( cls.__get_platform_to_use()).get_port() except: cls.portToUse = -1 cls.platform_to_use = cls.__get_platform_to_use() log.info("""\n\n #######################################
import unittest from flexmock import flexmock, flexmock_teardown from libs import CompilerUploader from libs.LoggingUtils import init_logging log = init_logging(__name__) class TestCompilerUploader(unittest.TestCase): def setUp(self): self.compiler = CompilerUploader.CompilerUploader.construct() self.platformio_run_mock = flexmock(CompilerUploader) def tearDown(self): flexmock_teardown() def test_parse_error_getsFileLineColumnAnErrorIfErrorExists(self): error_message = """"main.ino: In function 'int sum(int, int)': main.ino:9:14: error: invalid conversion from 'const char*' to 'int' [-fpermissive] main.ino: In function 'int sum2()': main.ino:14:1: error: expected ';' before '}' token scons: *** [.pioenvs/bt328/src/tmp_ino_to.o] Error 1""" error_info = [[False, dict(err=error_message)]] self.platformio_run_mock.should_receive("platformio_run").and_return(error_info) result = self.compiler.compile("") parse_error = result[1]["err"]
# Authors: Irene Sanz Nieto <*****@*****.**>, # # Sergio Morcuende <*****@*****.**> # # # # -----------------------------------------------------------------------# import importlib import pprint import signal import click from wshubsapi.hubs_inspector import HubsInspector from Scripts.TestRunner import * from libs.LoggingUtils import init_logging from libs.PathsManager import PathsManager log = init_logging(__name__) # initialized in main originalEcho = click.echo originalSEcho = click.secho def get_echo_function(original): def click_echo_for_executable(message, *args, **kwargs): try: original(message, *args, **kwargs) except: log.debug(message) return click_echo_for_executable click.echo = get_echo_function(originalEcho) click.secho = get_echo_function(originalSEcho)