Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_get_platformio_boards(self):
"""
PlatformIO identifiers of boards are requested using PlatformIO CLI in JSON format
"""
self.assertIsInstance(stm32pio.util.get_platformio_boards(platformio_cmd='platformio'), list)
def loading():
boards = ['None'] + stm32pio.util.get_platformio_boards('platformio')
boards_model.setStringList(boards)
path = pathlib.Path(dirty_path).expanduser().resolve(strict=True)
ioc_file = None
if path.is_file() and path.suffix == '.ioc': # if .ioc file was supplied instead of the directory
ioc_file = path
path = path.parent
self.path = path
self.config = self._load_config(parameters)
self.ioc_file = self._find_ioc_file(explicit_file=ioc_file)
self.config.set('project', 'ioc_file', self.ioc_file.name) # save only the name of file to the config
# Notify the caller about the board presence
if 'board' in parameters and parameters['board'] is not None:
try:
boards = stm32pio.util.get_platformio_boards(self.config.get('app', 'platformio_cmd'))
except Exception as e:
self.logger.warning(f"There was an error while obtaining possible PlatformIO boards: {e}",
exc_info=self.logger.isEnabledFor(logging.DEBUG))
boards = []
if parameters['board'] not in boards:
self.logger.warning(f"'{parameters['board']}' was not found in PlatformIO. "
"Run 'platformio boards' for possible names")
# Save the config on an instance destruction
if instance_options['save_on_destruction']:
self._finalizer = weakref.finalize(self, self._save_config, self.config, self.path, self.logger)