Skip to content

Commit

Permalink
test: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MaferMazu committed Aug 2, 2024
1 parent dea0046 commit dceae00
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test-lint: ## Run code linting tests
pylint --errors-only --enable=unused-import,unused-argument --ignore=templates --ignore=docs/_ext ${SRC_DIRS}

test-types: ## Run type checks.
mypy --exclude=templates --ignore-missing-imports --implicit-reexport ${SRC_DIRS}
mypy --exclude=templates --ignore-missing-imports --implicit-reexport --strict ${SRC_DIRS}

format: ## Format code automatically
black $(BLACK_OPTS)
Expand Down
3 changes: 2 additions & 1 deletion tutorpicasso/commands/enable_themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import click
from tutor import config as tutor_config
from tutor.types import Config


@click.command(name="enable-themes", help="Enable picasso themes")
Expand All @@ -18,7 +19,7 @@ def enable_themes() -> None:
.decode("utf-8")
.strip()
)
config = tutor_config.load(tutor_root)
config: Config = tutor_config.load(tutor_root)

if config.get("PICASSO_THEMES"):
for theme in config["PICASSO_THEMES"]:
Expand Down
9 changes: 5 additions & 4 deletions tutorpicasso/commands/run_extra_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
import subprocess

# Was necessary to use this for compatibility with Python 3.8
from typing import List
from typing import Any, List

import click
from tutor import config as tutor_config
from tutor.types import Config, ConfigValue

COMMAND_CHAINING_OPERATORS = ["&&", "&", "||", "|", ";"]

Expand All @@ -20,15 +21,15 @@ def run_extra_commands() -> None:
.decode("utf-8")
.strip()
)
config = tutor_config.load(tutor_root)
picasso_extra_commands = config.get("PICASSO_EXTRA_COMMANDS", None)
config: Config = tutor_config.load(tutor_root)
picasso_extra_commands: ConfigValue = config.get("PICASSO_EXTRA_COMMANDS", None)
if picasso_extra_commands is not None:
validate_commands(picasso_extra_commands)
for command in picasso_extra_commands:
run_command(command)


def validate_commands(commands: List[str]) -> None:
def validate_commands(commands: Any) -> None:
"""
Takes all the extra commands sent through config.yml and verifies that
all the commands are correct before executing them
Expand Down

0 comments on commit dceae00

Please sign in to comment.