summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharles Oliveira <charles.oliveira@linaro.org>2020-03-11 05:31:00 -0300
committerCharles Oliveira <charles.oliveira@linaro.org>2020-03-11 05:31:00 -0300
commit3a1aab9581b2ae714f7032d8450f355847a63c83 (patch)
treecd03839ba487a6f6340acd583fbf1543b771f53c /tests
parentb1b22bdd509a1f5f66d1b05a43b84d294cff8d99 (diff)
tests: add flake8 check
Diffstat (limited to 'tests')
-rw-r--r--tests/__init__.py1
-rw-r--r--tests/test_api.py1
-rw-r--r--tests/test_code_quality.py12
-rw-r--r--tests/test_models.py2
-rw-r--r--tests/test_report.py2
5 files changed, 15 insertions, 3 deletions
diff --git a/tests/__init__.py b/tests/__init__.py
index 7e13b33..4b43dfe 100644
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -1,6 +1,7 @@
import unittest
import os
+
def run():
loader = unittest.TestLoader()
tests = loader.discover(os.path.dirname(os.path.abspath(__file__)))
diff --git a/tests/test_api.py b/tests/test_api.py
index 0c6a811..82f0656 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -32,4 +32,3 @@ class SquadApiTest(TestCase):
SquadApi.get('/api/groups')
else:
self.assertTrue(SquadApi.get('/api/groups') is not None)
-
diff --git a/tests/test_code_quality.py b/tests/test_code_quality.py
new file mode 100644
index 0000000..e1b3590
--- /dev/null
+++ b/tests/test_code_quality.py
@@ -0,0 +1,12 @@
+import subprocess
+import shutil
+
+
+from unittest import TestCase
+
+if shutil.which('flake8'):
+ class TestCodeQuality(TestCase):
+ def test_flake8(self):
+ self.assertEqual(0, subprocess.call('flake8'))
+else:
+ print("I: skipping flake8 test (flake8 not available)")
diff --git a/tests/test_models.py b/tests/test_models.py
index 2883d28..072b08a 100644
--- a/tests/test_models.py
+++ b/tests/test_models.py
@@ -2,7 +2,7 @@ import unittest
from squad_client.core.api import SquadApi
-from squad_client.core.models import Squad, Group, Project, Build, TestJob, TestRun, Test, Suite, Environment, Backend, EmailTemplate, KnownIssue, SuiteMetadata, Annotation, MetricThreshold, Report
+from squad_client.core.models import Squad
from squad_client.utils import first
diff --git a/tests/test_report.py b/tests/test_report.py
index 12832f2..423082f 100644
--- a/tests/test_report.py
+++ b/tests/test_report.py
@@ -61,6 +61,7 @@ class ReportTest(unittest.TestCase):
generated = report.generate()
self.assertEqual('Report: fetched string', generated)
+
class ReportGeneratorTest(unittest.TestCase):
@patch('squad_client.core.models.Squad.fetch')
@@ -82,5 +83,4 @@ class ReportGeneratorTest(unittest.TestCase):
self.assertEqual(1, len(reports))
- report = reports[0]
self.assertEqual('Report: fetched string', output.getvalue())