Commit 71f32a7f authored by FichteFoll's avatar FichteFoll

Pretty-indent the tests

parent f864654d
......@@ -27,7 +27,6 @@ if sys.version_info >= (3,):
generator_method_type = 'method'
str_cls = str
else:
from . import unittest_compat
from urlparse import urljoin
from urllib2 import HTTPError, urlopen
generator_method_type = 'instancemethod'
......@@ -36,7 +35,8 @@ else:
if hasattr(sys, 'argv'):
arglist = ['--test-repositories']
# Exctract used arguments form the commandline an strip them for unittest.main
# Exctract used arguments form the commandline an strip them for
# unittest.main
userargs = [arg for arg in sys.argv if arg in arglist]
for arg in userargs:
if arg in sys.argv:
......@@ -175,7 +175,8 @@ class TestContainer(object):
self.assertIn('schema_version', data)
self.assertEqual(data['schema_version'], '3.0.0')
listkeys = [k for k in ('packages', 'dependencies', 'includes') if k in data]
listkeys = [k for k in ('packages', 'dependencies', 'includes')
if k in data]
self.assertGreater(len(listkeys), 0)
for k in listkeys:
self.assertIsInstance(data[k], list)
......@@ -270,7 +271,7 @@ class TestContainer(object):
def _test_release(self, package_name, data, main_repo=True):
# Fail early
if main_repo:
self.assertEqual(True, ('tags' in data or 'branch' in data),
self.assertTrue(('tags' in data or 'branch' in data),
'A release must have a "tags" key or "branch" key '
'if it is in the main repository. For custom '
'releases, a custom repository.json file must be '
......@@ -282,8 +283,7 @@ class TestContainer(object):
'request would be necessary for every release')
elif 'tags' not in data and 'branch' not in data:
for req in ('url', 'version', 'date'):
self.assertIn(req, data,
self.assertTrue(all(k in data for k in ('url', 'version', 'date')),
'A release must provide "url", "version" and '
'"date" keys if it does not specify "tags" or'
'"branch"')
......@@ -335,9 +335,11 @@ class TestContainer(object):
def _test_dependency_release(self, package_name, data, main_repo=True):
if main_repo:
self.assertEqual(True, ('tags' in data or 'branch' in data or (
'sha256' in data and 'version' in data and 'url' in data and
data['url'][0:7] == 'http://')),
self.assertTrue(('tags' in data
or 'branch' in data
or ('sha256' in data and 'version' in data
and 'url' in data
and data['url'][0:7] == 'http://')),
'A release must have a "tags" key or "branch" key '
'if it is in the main repository. For custom '
'releases, a custom repository.json file must be '
......@@ -350,7 +352,8 @@ class TestContainer(object):
self.assertNotIn(req, data,
'The version and url keys should not be '
'used in the main repository since a pull '
'request would be necessary for every release')
'request would be necessary for every '
'release.')
elif 'tags' not in data and 'branch' not in data:
for req in ('url', 'version'):
......@@ -488,7 +491,8 @@ class TestContainer(object):
return
# Do not generate 1000 failing tests for not yet updated repos
if schema != '3.0.0':
cls._write(stream, "skipping (schema version %s)\n" % data['schema_version'])
cls._write(stream, "skipping (schema version %s)\n"
% data['schema_version'])
return
cls._write(stream, 'done\n')
......@@ -562,7 +566,7 @@ class DefaultChannelTests(TestContainer, unittest.TestCase):
@classmethod
def generate_repository_tests(cls, stream):
if not "--test-repositories" in userargs:
if "--test-repositories" not in userargs:
# Only generate tests for all repositories (those hosted online)
# when run with "--test-repositories" parameter.
return
......@@ -636,7 +640,8 @@ class DefaultRepositoryTests(TestContainer, unittest.TestCase):
if 'releases' in dependency:
for release in dependency['releases']:
(yield cls._test_dependency_release,
("%s (%s)" % (dependency_name, include), release))
("%s (%s)" % (dependency_name, include),
release))
def generate_default_test_methods(stream=None):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment