Skip to content

Commit 26d5d9e

Browse files
committed
Merge pull request #124 from xmlrunner/qa
pep8 / flake8 for test code.
2 parents 01055b3 + 649a628 commit 26d5d9e

File tree

11 files changed

+74
-39
lines changed

11 files changed

+74
-39
lines changed

tests/builder_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def test_end_root_context(self):
135135

136136
def test_end_nested_context(self):
137137
self.builder.begin_context('testsuite', 'name')
138-
nested = self.builder.current_context()
138+
self.builder.current_context()
139139

140140
self.assertTrue(self.builder.end_context())
141141

@@ -187,7 +187,7 @@ def test_append_invalid_unicode_cdata_section(self):
187187
self.assertEqual(cdata.data, self.invalid_chars_replace)
188188

189189
def test_append_cdata_closing_tags_into_cdata_section(self):
190-
self.builder.append_cdata_section('tag',']]>')
190+
self.builder.append_cdata_section('tag', ']]>')
191191
self.builder.end_context()
192192
root_child = self.doc.childNodes[0]
193193
cdata_container = root_child.childNodes[0]

tests/django_example/app/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from django.contrib import admin
1+
from django.contrib import admin # NOQA
22

33
# Register your models here.

tests/django_example/app/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from django.db import models
1+
from django.db import models # NOQA
22

33
# Create your models here.

tests/django_example/app/tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from django.test import TestCase
22

3+
34
# Create your tests here.
45
class DummyTestCase(TestCase):
56
def test_pass(self):
6-
pass
7+
pass

tests/django_example/app/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from django.shortcuts import render
1+
from django.shortcuts import render # NOQA
22

33
# Create your views here.

tests/django_example/app2/admin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from django.contrib import admin
1+
from django.contrib import admin # NOQA
22

33
# Register your models here.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from django.db import models
1+
from django.db import models # NOQA
22

33
# Create your models here.

tests/django_example/app2/tests.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from django.test import TestCase
22

3+
34
# Create your tests here.
45
class DummyTestCase(TestCase):
56
def test_pass(self):

tests/django_example/app2/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
from django.shortcuts import render
1+
from django.shortcuts import render # NOQA
22

33
# Create your views here.

tests/django_test.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from xmlrunner.unittest import unittest
22

33
import sys
4-
import os
54
from os import path, chdir, getcwd
65

76
try:
@@ -13,8 +12,10 @@
1312

1413
TESTS_DIR = path.dirname(__file__)
1514

15+
1616
@unittest.skipIf(django is None, 'django not found')
1717
class DjangoTest(unittest.TestCase):
18+
1819
def setUp(self):
1920
self._old_cwd = getcwd()
2021
self.project_dir = path.abspath(path.join(TESTS_DIR, 'django_example'))
@@ -27,30 +28,30 @@ def tearDown(self):
2728
chdir(self._old_cwd)
2829

2930
def _check_runner(self, runner):
30-
suite = runner.build_suite(test_labels=['app2','app'])
31-
test_ids = [ test.id() for test in suite ]
31+
suite = runner.build_suite(test_labels=['app2', 'app'])
32+
test_ids = [test.id() for test in suite]
3233
self.assertEqual(test_ids, [
3334
'app2.tests.DummyTestCase.test_pass',
3435
'app.tests.DummyTestCase.test_pass',
3536
])
3637
suite = runner.build_suite(test_labels=[])
37-
test_ids = [ test.id() for test in suite ]
38+
test_ids = [test.id() for test in suite]
3839
self.assertEqual(set(test_ids), set([
3940
'app.tests.DummyTestCase.test_pass',
4041
'app2.tests.DummyTestCase.test_pass',
4142
]))
4243

4344
def test_django_runner(self):
4445
from django.conf import settings
45-
settings.configure(INSTALLED_APPS=['app','app2'])
46+
settings.configure(INSTALLED_APPS=['app', 'app2'])
4647
runner_class = get_runner(settings)
4748
runner = runner_class()
4849
self._check_runner(runner)
4950

5051
def test_django_xmlrunner(self):
5152
from django.conf import settings
5253
settings.configure(
53-
INSTALLED_APPS=['app','app2'],
54+
INSTALLED_APPS=['app', 'app2'],
5455
TEST_RUNNER='xmlrunner.extra.djangotestrunner.XMLTestRunner')
5556
runner_class = get_runner(settings)
5657
runner = runner_class()

0 commit comments

Comments
 (0)