@@ -24,8 +24,9 @@ def test_bad_order(self):
2424 ['build' , {}],
2525 ['source' , {}]])
2626 lints = linter .lintify (meta )
27- expected_message = "The top level meta keys are in an unexpected order. Expecting ['package', 'source', 'build']."
28- self .assertIn (expected_message , lints )
27+ expected_msg = ("The top level meta keys are in an unexpected "
28+ "order. Expecting ['package', 'source', 'build']." )
29+ self .assertIn (expected_msg , lints )
2930
3031 def test_missing_about_license_and_summary (self ):
3132 meta = {'about' : {'home' : 'a URL' }}
@@ -66,7 +67,8 @@ def test_missing_about_home_empty(self):
6667 self .assertIn (expected_message , lints )
6768
6869 def test_maintainers_section (self ):
69- expected_message = 'The recipe could do with some maintainers listed in the "extra/recipe-maintainers" section.'
70+ expected_message = ('The recipe could do with some maintainers listed '
71+ 'in the "extra/recipe-maintainers" section.' )
7072
7173 lints = linter .lintify ({'extra' : {'recipe-maintainers' : []}})
7274 self .assertIn (expected_message , lints )
@@ -88,7 +90,8 @@ def test_test_section(self):
8890 self .assertNotIn (expected_message , lints )
8991
9092 def test_test_section_with_recipe (self ):
91- # If we have a run_test.py file, we shouldn't need to provide other tests.
93+ # If we have a run_test.py file, we shouldn't need to provide
94+ # other tests.
9295
9396 expected_message = 'The recipe must have some tests.'
9497
@@ -102,7 +105,8 @@ def test_test_section_with_recipe(self):
102105 self .assertNotIn (expected_message , lints )
103106
104107 def test_selectors (self ):
105- expected_message = 'Selectors are suggested to take a " # [<selector>]" form.'
108+ expected_message = ('Selectors are suggested to take a '
109+ '" # [<selector>]" form.' )
106110
107111 with tmp_directory () as recipe_dir :
108112 def assert_selector (selector , is_good = True ):
@@ -114,11 +118,14 @@ def assert_selector(selector, is_good=True):
114118 """ .format (selector ))
115119 lints = linter .lintify ({}, recipe_dir )
116120 if is_good :
117- message = "Found lints when there shouldn't have been a lint for '{}'." .format (selector )
121+ message = ("Found lints when there shouldn't have been a "
122+ "lint for '{}'." .format (selector ))
118123 else :
119- message = "Expecting lints for '{}', but didn't get any." .format (selector )
124+ message = ("Expecting lints for '{}', but didn't get any."
125+ "" .format (selector ))
120126 self .assertEqual (not is_good ,
121- any (lint .startswith (expected_message ) for lint in lints ),
127+ any (lint .startswith (expected_message )
128+ for lint in lints ),
122129 message )
123130
124131 assert_selector ("name: foo_py3 # [py3k]" )
@@ -141,8 +148,8 @@ def test_missing_build_number(self):
141148 self .assertIn (expected_message , lints )
142149
143150 def test_bad_requirements_order (self ):
144- expected_message = ("The `requirements/build` section should be defined "
145- "before the `requirements/run` section." )
151+ expected_message = ("The `requirements/build` section should be "
152+ "defined before the `requirements/run` section." )
146153
147154 meta = {'requirements' : OrderedDict ([['run' , 'a' ],
148155 ['build' , 'a' ]])}
@@ -154,6 +161,21 @@ def test_bad_requirements_order(self):
154161 lints = linter .lintify (meta )
155162 self .assertNotIn (expected_message , lints )
156163
164+ def test_no_sha_with_dl (self ):
165+ expected_message = ("When defining a source/url please add a sha256, "
166+ "sha1 or md5 checksum (sha256 preferably)." )
167+ meta = {'source' : {'url' : None }}
168+ self .assertIn (expected_message , linter .lintify (meta ))
169+
170+ meta = {'source' : {'url' : None , 'sha1' : None }}
171+ self .assertNotIn (expected_message , linter .lintify (meta ))
172+
173+ meta = {'source' : {'url' : None , 'sha256' : None }}
174+ self .assertNotIn (expected_message , linter .lintify (meta ))
175+
176+ meta = {'source' : {'url' : None , 'md5' : None }}
177+ self .assertNotIn (expected_message , linter .lintify (meta ))
178+
157179
158180class TestCLI_recipe_lint (unittest .TestCase ):
159181 def test_cli_fail (self ):
@@ -165,7 +187,8 @@ def test_cli_fail(self):
165187 build: []
166188 requirements: []
167189 """ ))
168- child = subprocess .Popen (['conda-smithy' , 'recipe-lint' , recipe_dir ],
190+ child = subprocess .Popen (['conda-smithy' , 'recipe-lint' ,
191+ recipe_dir ],
169192 stdout = subprocess .PIPE )
170193 out , _ = child .communicate ()
171194 self .assertEqual (child .returncode , 1 , out )
@@ -188,7 +211,8 @@ def test_cli_success(self):
188211 - a
189212 - b
190213 """ ))
191- child = subprocess .Popen (['conda-smithy' , 'recipe-lint' , recipe_dir ],
214+ child = subprocess .Popen (['conda-smithy' , 'recipe-lint' ,
215+ recipe_dir ],
192216 stdout = subprocess .PIPE )
193217 out , _ = child .communicate ()
194218 self .assertEqual (child .returncode , 0 , out )
0 commit comments