diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..97dcd4f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,11 @@ +root = true + +[*] +end_of_line = lf +insert_final_newline = true + +[*.py] +indent_style = space +indent_size = 4 +charset = utf-8 +trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore index 35418fc..c918e54 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ build/ env/ env3/ *.log +tmp/ # editors .vscode/ diff --git a/nodemcu-uploader.py b/nodemcu-uploader.py index 1f0ca81..a664eb2 100755 --- a/nodemcu-uploader.py +++ b/nodemcu-uploader.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (C) 2015-2019 Peter Magnusson -#pylint: disable=C0103 +# pylint: disable=C0103 """makes it easier to run nodemcu-uploader from command line""" from nodemcu_uploader import main diff --git a/nodemcu_uploader/__init__.py b/nodemcu_uploader/__init__.py index d8ca624..db1637b 100644 --- a/nodemcu_uploader/__init__.py +++ b/nodemcu_uploader/__init__.py @@ -4,5 +4,5 @@ """Library and util for uploading files to NodeMCU version 0.9.4 and later""" -from .version import __version__ -from .uploader import Uploader +from .version import __version__ # noqa: F401 +from .uploader import Uploader # noqa: F401 diff --git a/tests/misc.py b/tests/misc.py index a72bfbc..9759f34 100644 --- a/tests/misc.py +++ b/tests/misc.py @@ -7,26 +7,28 @@ from nodemcu_uploader import validate, exceptions + class MiscTestCase(unittest.TestCase): def test_version(self): - self.assertEqual(__version__, '0.4.3') + self.assertEqual(__version__, '0.5.0') def test_default_port(self): if os.environ.get('SERIALPORT', 'none') != 'none': - #SERIALPORT should override any system defaults + # SERIALPORT should override any system defaults self.assertEqual(default_port(), os.environ['SERIALPORT']) else: - #Test as if it were given system + # Test as if it were given system self.assertEqual(default_port('Linux'), '/dev/ttyUSB0') self.assertEqual(default_port('Windows'), 'COM1') self.assertEqual(default_port('Darwin'), '/dev/tty.SLAB_USBtoUART') - + def test_remote_path_validation(self): validate.remotePath("test/something/maximum/len.jpeg") validate.remotePath("a") + def v(p): validate.remotePath(p) - + self.assertRaises(exceptions.PathLengthException, (lambda: v("test/something/maximum/leng.jpeg"))) - self.assertRaises(exceptions.PathLengthException, (lambda: v(""))) \ No newline at end of file + self.assertRaises(exceptions.PathLengthException, (lambda: v("")))