diff --git a/MethodicConfigurator/annotate_params.py b/MethodicConfigurator/annotate_params.py index 2b2eec6..69c8f45 100644 --- a/MethodicConfigurator/annotate_params.py +++ b/MethodicConfigurator/annotate_params.py @@ -16,8 +16,6 @@ Supports sorting the parameters Has unit tests with 88% coverage -AP_FLAKE8_CLEAN - Author: Amilcar do Carmo Lucas, IAV GmbH """ diff --git a/MethodicConfigurator/extract_param_defaults.py b/MethodicConfigurator/extract_param_defaults.py index 4b18595..080b503 100644 --- a/MethodicConfigurator/extract_param_defaults.py +++ b/MethodicConfigurator/extract_param_defaults.py @@ -7,8 +7,6 @@ Currently has 95% unit test coverage -AP_FLAKE8_CLEAN - Amilcar do Carmo Lucas, IAV GmbH ''' diff --git a/credits/update-credit-licenses.py b/credits/update_credits_licenses.py similarity index 98% rename from credits/update-credit-licenses.py rename to credits/update_credits_licenses.py index 1365286..6d1ff11 100644 --- a/credits/update-credit-licenses.py +++ b/credits/update_credits_licenses.py @@ -44,7 +44,7 @@ def download_license(package_name, license_url): try: - response = requests.get(license_url) + response = requests.get(license_url, timeout=10) response.raise_for_status() # Raise an exception if the request failed # Use a fixed filename for the Mozilla Public License version 2.0 if package_name in ["Scrollable_TK_frame", "Python_Tkinter_ComboBox"]: diff --git a/setup.py b/setup.py index 0459cb8..cdb1234 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,20 @@ -from setuptools import setup -from setuptools import find_packages +#!/usr/bin/env python3 + +''' +This script downloads the licenses of the direct and indirect dependencies of the project + +This file is part of Ardupilot methodic configurator. https://github.com/ArduPilot/MethodicConfigurator + +(C) 2024 Amilcar do Carmo Lucas, IAV GmbH + +SPDX-License-Identifier: GPL-3 +''' import os +from setuptools import setup +from setuptools import find_packages + from MethodicConfigurator.version import VERSION @@ -35,20 +47,20 @@ def package_files(directory): # Add any other development requirements here ] -prj_url = "https://github.com/ArduPilot/MethodicConfigurator" +PRJ_URL = "https://github.com/ArduPilot/MethodicConfigurator" # Read the long description from the README file with open('README.md', 'r', encoding='utf-8') as f: long_description = f.read() # Use Absolute links so that the pyPI page renders correctly - long_description = long_description.replace("(USERMANUAL.md", f"({prj_url}/blob/master/USERMANUAL.md") - long_description = long_description.replace("(CONTRIBUTING.md", f"({prj_url}/blob/master/CONTRIBUTING.md") - long_description = long_description.replace("(ARCHITECTURE.md", f"({prj_url}/blob/master/ARCHITECTURE.md") - long_description = long_description.replace("(CODE_OF_CONDUCT.md", f"({prj_url}/blob/master/CODE_OF_CONDUCT.md") - long_description = long_description.replace("(LICENSE.md", f"({prj_url}/blob/master/LICENSE.md") - long_description = long_description.replace("(credits/CREDITS.md", f"({prj_url}/blob/master/credits/CREDITS.md") + long_description = long_description.replace("(USERMANUAL.md", f"({PRJ_URL}/blob/master/USERMANUAL.md") + long_description = long_description.replace("(CONTRIBUTING.md", f"({PRJ_URL}/blob/master/CONTRIBUTING.md") + long_description = long_description.replace("(ARCHITECTURE.md", f"({PRJ_URL}/blob/master/ARCHITECTURE.md") + long_description = long_description.replace("(CODE_OF_CONDUCT.md", f"({PRJ_URL}/blob/master/CODE_OF_CONDUCT.md") + long_description = long_description.replace("(LICENSE.md", f"({PRJ_URL}/blob/master/LICENSE.md") + long_description = long_description.replace("(credits/CREDITS.md", f"({PRJ_URL}/blob/master/credits/CREDITS.md") long_description = long_description.replace("images/App_screenshot1.png", - f"{prj_url}/raw/master/images/App_screenshot1.png") + f"{PRJ_URL}/raw/master/images/App_screenshot1.png") setup( name='MethodicConfigurator', @@ -57,7 +69,7 @@ def package_files(directory): description='A clear configuration sequence for ArduPilot vehicles', long_description=long_description, long_description_content_type='text/markdown', - url=prj_url, + url=PRJ_URL, author='Amilcar do Carmo Lucas', author_email='amilcar.lucas@iav.de', packages=find_packages(), diff --git a/unittests/annotate_params_unittest.py b/unittests/annotate_params_unittest.py index 1ea322f..537453c 100755 --- a/unittests/annotate_params_unittest.py +++ b/unittests/annotate_params_unittest.py @@ -5,11 +5,11 @@ parameter documentation (if not cached) and adds it to the specified file or to all *.param and *.parm files in the specified directory. -AP_FLAKE8_CLEAN - Author: Amilcar do Carmo Lucas, IAV GmbH ''' +# pylint: skip-file + import tempfile from unittest.mock import patch, mock_open import os diff --git a/unittests/ardupilot_methodic_configurator_unittest.py b/unittests/ardupilot_methodic_configurator_unittest.py index 2f8405e..0a4e0b3 100755 --- a/unittests/ardupilot_methodic_configurator_unittest.py +++ b/unittests/ardupilot_methodic_configurator_unittest.py @@ -8,12 +8,12 @@ SPDX-License-Identifier: GPL-3 ''' +# pylint: skip-file + import argparse import unittest from unittest.mock import patch, MagicMock, mock_open from ardupilot_methodic_configurator import argument_parser -from ardupilot_methodic_configurator import create_connection_with_retry -from ardupilot_methodic_configurator import read_params_from_files class TestArgumentParser(unittest.TestCase): @@ -25,24 +25,5 @@ def test_argument_parser(self, mock_args): self.assertEqual(args.params, 'params_dir') -class TestConnectionCreation(unittest.TestCase): - @patch('param_gui.mavutil.mavlink_connection', return_value=MagicMock()) - def test_create_connection_with_retry(self, mock_mavlink_connection): - conn_string = 'tcp:127.0.0.1:5760' - master = create_connection_with_retry(conn_string) - self.assertEqual(master, "") - mock_mavlink_connection.assert_called_once_with(conn_string, timeout=5) - - -class TestReadParamsFromFiles(unittest.TestCase): - @patch('os.listdir', return_value=['file1.param']) - @patch('builtins.open', new_callable=mock_open, read_data='param1 1.0\nparam2 2.0') - def test_read_params_from_files(self, mock_file, mock_listdir): - params_dir = '.' - params = read_params_from_files(params_dir) - expected_params = {'file1.param': {'param1': '1.0', 'param2': '2.0'}} - self.assertEqual(params, expected_params) - - if __name__ == '__main__': unittest.main() diff --git a/unittests/backend_filesystem_unittest.py b/unittests/backend_filesystem_unittest.py index 90e8ddf..00bb0b3 100755 --- a/unittests/backend_filesystem_unittest.py +++ b/unittests/backend_filesystem_unittest.py @@ -8,6 +8,8 @@ SPDX-License-Identifier: GPL-3 ''' +# pylint: skip-file + import unittest # import os from unittest.mock import patch, MagicMock diff --git a/unittests/extract_param_defaults_unittest.py b/unittests/extract_param_defaults_unittest.py index a6ca323..35ef6cf 100755 --- a/unittests/extract_param_defaults_unittest.py +++ b/unittests/extract_param_defaults_unittest.py @@ -3,11 +3,11 @@ ''' Extracts parameter default values from an ArduPilot .bin file. Unittests. -AP_FLAKE8_CLEAN - Amilcar do Carmo Lucas, IAV GmbH ''' +# pylint: skip-file + import unittest from unittest.mock import patch, MagicMock diff --git a/unittests/frontend_tkinter_unittest.py b/unittests/frontend_tkinter_unittest.py index 0d8af77..cfb97fb 100644 --- a/unittests/frontend_tkinter_unittest.py +++ b/unittests/frontend_tkinter_unittest.py @@ -8,6 +8,8 @@ SPDX-License-Identifier: GPL-3 ''' +# pylint: skip-file + import unittest from unittest.mock import patch, MagicMock import tkinter as tk diff --git a/unittests/param_pid_adjustment_update_unittest.py b/unittests/param_pid_adjustment_update_unittest.py index 00e0393..fcf1033 100755 --- a/unittests/param_pid_adjustment_update_unittest.py +++ b/unittests/param_pid_adjustment_update_unittest.py @@ -13,6 +13,8 @@ SPDX-License-Identifier: GPL-3 ''' +# pylint: skip-file + import unittest import argparse import os