Skip to content

Commit

Permalink
ammend remove TestCLI_recipe_lint class
Browse files Browse the repository at this point in the history
  • Loading branch information
hulkoba committed Jul 2, 2024
1 parent c4424e9 commit c261425
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions tests/test_lint_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import subprocess
import tempfile
import textwrap
import unittest
import warnings

import github
Expand Down Expand Up @@ -1662,8 +1661,8 @@ def test_go_license_bundling():


@pytest.mark.cli
class TestCLI_recipe_lint(unittest.TestCase):
def test_cli_fail(self):
class TestCLI_recipe_lint():
def test_cli_fail():
with tmp_directory() as recipe_dir:
with io.open(os.path.join(recipe_dir, "meta.yaml"), "w") as fh:
fh.write(
Expand All @@ -1681,9 +1680,9 @@ def test_cli_fail(self):
stdout=subprocess.PIPE,
)
out, _ = child.communicate()
self.assertEqual(child.returncode, 1, out)
assert child.returncode == 1, out

def test_cli_success(self):
def test_cli_success():
with tmp_directory() as recipe_dir:
with io.open(os.path.join(recipe_dir, "meta.yaml"), "w") as fh:
fh.write(
Expand Down Expand Up @@ -1712,9 +1711,9 @@ def test_cli_success(self):
stdout=subprocess.PIPE,
)
out, _ = child.communicate()
self.assertEqual(child.returncode, 0, out)
assert child.returncode == 0, out

def test_cli_environ(self):
def test_cli_environ():
with tmp_directory() as recipe_dir:
with io.open(os.path.join(recipe_dir, "meta.yaml"), "w") as fh:
fh.write(
Expand Down Expand Up @@ -1745,9 +1744,9 @@ def test_cli_environ(self):
stdout=subprocess.PIPE,
)
out, _ = child.communicate()
self.assertEqual(child.returncode, 0, out)
assert child.returncode == 0, out

def test_unicode(self):
def test_unicode():
"""
Tests that unicode does not confuse the linter.
"""
Expand All @@ -1771,7 +1770,7 @@ def test_unicode(self):
# Just run it and make sure it does not raise.
linter.main(recipe_dir)

def test_jinja_variable_def(self):
def test_jinja_variable_def():
expected_message = (
"Jinja2 variable definitions are suggested to "
"take a ``{{%<one space>set<one space>"
Expand Down Expand Up @@ -1803,11 +1802,9 @@ def assert_jinja(jinja_var, is_good=True):
"Expecting lints for '{}', but didn't get any."
"".format(jinja_var)
)
self.assertEqual(
not is_good,
any(lint.startswith(expected_message) for lint in lints),
message,
)
assert not is_good == any(
lint.startswith(expected_message) for lint in lints
), message

assert_jinja('{% set version = "0.27.3" %}')
assert_jinja('{% set version="0.27.3" %}', is_good=False)
Expand Down

0 comments on commit c261425

Please sign in to comment.