Skip to content

Commit

Permalink
Applied pylint and added a make lint command
Browse files Browse the repository at this point in the history
  • Loading branch information
maerteijn committed Dec 16, 2020
1 parent fa8a4ec commit cbfe79d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 14 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ install:
- make install

script:
- make lint
- make nosetest
- make docker_test
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[pylint.MASTER]
jobs=4

[pylint.'MESSAGES CONTROL']
disable = R,C,W5103
2 changes: 1 addition & 1 deletion vdt/simpleaptrepo/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create_gpg_key(output_command):
try:
output_command(subprocess.check_output(cmd, shell=True))
except subprocess.CalledProcessError as e:
raise ValueError(e)
raise ValueError from e


def export_pubkey(path, gpgkey, output_command):
Expand Down
7 changes: 2 additions & 5 deletions vdt/simpleaptrepo/tests/test_cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
try:
import ConfigParser # python 2
except:
import configparser as ConfigParser # python 3
import configparser as ConfigParser

import os
import shutil
Expand Down Expand Up @@ -181,7 +178,7 @@ def test_list_repos(self):
self.assertEqual(result.output, LIST_REPOS_OUTPUT)

@mock.patch("subprocess.check_output", return_value="Mocked output")
def test_update_repo(self, mock_subprocess=None):
def test_update_repo(self, mock_subprocess=None): # pylint: disable=W0613
runner = CliRunner()

with runner.isolated_filesystem():
Expand Down
12 changes: 6 additions & 6 deletions vdt/simpleaptrepo/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,24 @@


def mock_dist_osx():
return ("Mac OSX", "10.10.5", "Yosemity")
return "macOS-10.14.6-x86_64-i386-64bit"


def mock_dist_ubuntu():
return ("Ubuntu", "12.04", "precise")
return "Linux-4.10.0-40-generic-x86_64-with-Ubuntu-16.04-xenial"


def mock_dist_debian():
return ("debian", "8.6", "")
return "Linux-4.10.0-40-generic-x86_64-with-Debian-10"


class TestUtils(unittest.TestCase):
def test_platform_is_debian(self):
utils.platform.dist = mock_dist_osx
utils.platform.platform = mock_dist_osx
self.assertFalse(utils.platform_is_debian())

utils.platform.dist = mock_dist_ubuntu
utils.platform.platform = mock_dist_ubuntu
self.assertTrue(utils.platform_is_debian())

utils.platform.dist = mock_dist_debian
utils.platform.platform = mock_dist_debian
self.assertTrue(utils.platform_is_debian())
4 changes: 2 additions & 2 deletions vdt/simpleaptrepo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ def write_to_stdout(message):


def platform_is_debian():
current_platform = platform.dist()[0].lower()
return current_platform in ["ubuntu", "debian"]
current_platform = platform.platform().lower()
return "ubuntu" in current_platform or "debian" in current_platform

0 comments on commit cbfe79d

Please sign in to comment.