Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
linting and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
kmpm committed Dec 12, 2019
1 parent 57cf749 commit adb5847
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
11 changes: 11 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ build/
env/
env3/
*.log
tmp/

# editors
.vscode/
Expand Down
2 changes: 1 addition & 1 deletion nodemcu-uploader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (C) 2015-2019 Peter Magnusson <[email protected]>
#pylint: disable=C0103
# pylint: disable=C0103
"""makes it easier to run nodemcu-uploader from command line"""

from nodemcu_uploader import main
Expand Down
4 changes: 2 additions & 2 deletions nodemcu_uploader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
14 changes: 8 additions & 6 deletions tests/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("")))
self.assertRaises(exceptions.PathLengthException, (lambda: v("")))

0 comments on commit adb5847

Please sign in to comment.