Skip to content

Commit

Permalink
lint bah
Browse files Browse the repository at this point in the history
  • Loading branch information
aappleby committed Mar 13, 2024
1 parent 15cf3f4 commit 22e865f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 8 additions & 6 deletions hancho.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import subprocess
import sys
import traceback
from turtle import st
import types
from pathlib import Path
from glob import glob
Expand Down Expand Up @@ -72,8 +71,7 @@ def swap_ext(name, new_ext):
return None
if isinstance(name, list):
return [swap_ext(n, new_ext) for n in name]
else:
return Path(name).with_suffix(new_ext)
return Path(name).with_suffix(new_ext)


def mtime(filename):
Expand Down Expand Up @@ -163,7 +161,9 @@ def expand_async(rule, template):
# expression directly to the output for debugging.
replacement = ""
try:
replacement = eval(exp[1:-1], globals(), rule) # pylint: disable=eval-used
replacement = eval(
exp[1:-1], globals(), rule
) # pylint: disable=eval-used
except Exception: # pylint: disable=broad-except
replacement = exp

Expand Down Expand Up @@ -217,7 +217,6 @@ async def await_variant(variant):
return variant



################################################################################


Expand Down Expand Up @@ -619,6 +618,7 @@ async def run_async(self):

########################################

# pylint: disable=too-many-branches
async def task_main(self):
"""
All the steps needed to run a task and check the result.
Expand Down Expand Up @@ -680,7 +680,9 @@ async def task_main(self):
########################################

def flatten(self):
# Flatten all filename promises in any of the input filename arrays.
"""
Flatten all filename promises in any of the input filename arrays.
"""
self.files_in = flatten(self.files_in)
self.files_out = flatten(self.files_out)
self.deps = flatten(self.deps)
Expand Down
4 changes: 4 additions & 0 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def run_hancho(name):
################################################################################


# pylint: disable=too-many-public-methods
class TestHancho(unittest.TestCase):
"""Basic test cases"""

Expand Down Expand Up @@ -193,6 +194,9 @@ def test_sync_command(self):
self.assertTrue(path.exists("build/result.txt"))

def test_cancellation(self):
"""
A task that receives a cancellation exception should not run.
"""
self.assertNotEqual(0, run_hancho("cancellation"))
self.assertTrue(Path("build/pass_result.txt").exists())
self.assertFalse(Path("build/fail_result.txt").exists())
Expand Down

0 comments on commit 22e865f

Please sign in to comment.