aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Quigley <code@bryanquigley.com>2020-08-11 17:25:18 -0700
committerJake Hunsaker <jhunsake@redhat.com>2020-08-13 10:14:16 -0400
commit85b4e423cc23d7ba316d44b665b42a71f1324670 (patch)
treea57cbe035780b02ce0a93e39f3316ebb266bf006
parenta80825dbb9e28306d9d2dac8114f00f03cce0c9a (diff)
downloadsos-85b4e423cc23d7ba316d44b665b42a71f1324670.tar.gz
[general] flake8 first pass
Signed-off-by: Bryan Quigley <code@bryanquigley.com> Signed-off-by: Jake Hunsaker <jhunsake@redhat.com>
-rw-r--r--.travis.yml4
-rw-r--r--sos/component.py1
-rw-r--r--tests/archive_tests.py1
-rw-r--r--tests/cleaner_tests.py1
-rw-r--r--tests/plugin_tests.py12
-rw-r--r--tests/report_tests.py1
-rw-r--r--tests/sosreport_pexpect.py1
7 files changed, 8 insertions, 13 deletions
diff --git a/.travis.yml b/.travis.yml
index bf225c93..eaca2d06 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,12 @@
jobs:
include:
- - name: "20.04 pycodestyle and native run (py3.8)"
+ - name: "20.04 flake8 and native run (py3.8)"
os: linux
dist: focal
language: shell
install: sudo apt-get update; sudo apt install pycodestyle python3-pexpect;
script:
- - "pycodestyle sos tests bin/*"
+ - "flake8 sos tests bin/*"
- "sudo ./tests/simple.sh"
- name: "18.04 pycodestyle and native run (py3.6)"
os: linux
diff --git a/sos/component.py b/sos/component.py
index 462e3f33..0aef770c 100644
--- a/sos/component.py
+++ b/sos/component.py
@@ -18,6 +18,7 @@ import sys
from argparse import SUPPRESS
from datetime import datetime
from shutil import rmtree
+from pathlib import Path
from sos import __version__
from sos.archive import TarFileArchive
from sos.options import SoSOptions
diff --git a/tests/archive_tests.py b/tests/archive_tests.py
index 7bc9ef15..320006d0 100644
--- a/tests/archive_tests.py
+++ b/tests/archive_tests.py
@@ -8,7 +8,6 @@
import unittest
import os
import tarfile
-import zipfile
import tempfile
import shutil
diff --git a/tests/cleaner_tests.py b/tests/cleaner_tests.py
index aee1147d..43545126 100644
--- a/tests/cleaner_tests.py
+++ b/tests/cleaner_tests.py
@@ -62,7 +62,6 @@ class CleanerMapTests(unittest.TestCase):
self.assertTrue(_test.ip in _net.network)
def test_ip_map_get_same_with_or_without_cidr(self):
- _net = self.ip_map.get('192.168.4.0/24')
_hostwsub = self.ip_map.get('192.168.4.1/24')
_hostnosub = self.ip_map.get('192.168.4.1')
self.assertEqual(_hostwsub.split('/')[0], _hostnosub)
diff --git a/tests/plugin_tests.py b/tests/plugin_tests.py
index 2e2e6abd..9290003a 100644
--- a/tests/plugin_tests.py
+++ b/tests/plugin_tests.py
@@ -15,7 +15,6 @@ from io import StringIO
from sos.report.plugins import Plugin, regex_findall, _mangle_command
from sos.archive import TarFileArchive
from sos.policies import LinuxPolicy, InitSystem
-import sos.policies
PATH = os.path.dirname(__file__)
@@ -196,7 +195,7 @@ class PluginTests(unittest.TestCase):
})
self.assertEquals(p.get_description(), "<no description available>")
- def test_plugin_no_descrip(self):
+ def test_plugin_has_descrip(self):
p = NamedMockPlugin({
'sysroot': self.sysroot,
'policy': LinuxPolicy(init=InitSystem(), probe_runtime=False),
@@ -339,7 +338,6 @@ class AddCopySpecTests(unittest.TestCase):
'cmdlineopts': MockOptions(),
'policy': LinuxPolicy(init=InitSystem(), probe_runtime=False),
'sysroot': os.getcwd(),
- 'cmdlineopts': MockOptions(),
'devices': {}
})
self.mp.archive = MockArchive()
@@ -383,8 +381,8 @@ class AddCopySpecTests(unittest.TestCase):
def test_glob_file_limit_no_limit(self):
self.mp.sysroot = '/'
tmpdir = tempfile.mkdtemp()
- fn = create_file(2, dir=tmpdir)
- fn2 = create_file(2, dir=tmpdir)
+ create_file(2, dir=tmpdir)
+ create_file(2, dir=tmpdir)
self.mp.add_copy_spec(tmpdir + "/*")
self.assertEquals(len(self.mp.copy_paths), 2)
shutil.rmtree(tmpdir)
@@ -392,8 +390,8 @@ class AddCopySpecTests(unittest.TestCase):
def test_glob_file_over_limit(self):
self.mp.sysroot = '/'
tmpdir = tempfile.mkdtemp()
- fn = create_file(2, dir=tmpdir)
- fn2 = create_file(2, dir=tmpdir)
+ create_file(2, dir=tmpdir)
+ create_file(2, dir=tmpdir)
self.mp.add_copy_spec(tmpdir + "/*", 1)
self.assertEquals(len(self.mp.copy_strings), 1)
content, fname = self.mp.copy_strings[0]
diff --git a/tests/report_tests.py b/tests/report_tests.py
index 86d56e7e..bb059012 100644
--- a/tests/report_tests.py
+++ b/tests/report_tests.py
@@ -6,7 +6,6 @@
#
# See the LICENSE file in the source distribution for further information.
import unittest
-import os
try:
import json
diff --git a/tests/sosreport_pexpect.py b/tests/sosreport_pexpect.py
index 095b6f1b..3614fa5b 100644
--- a/tests/sosreport_pexpect.py
+++ b/tests/sosreport_pexpect.py
@@ -8,7 +8,6 @@
import unittest
import pexpect
-from re import search, escape
from os import kill
from signal import SIGINT