Added isort config; linter now checks tests
continuous-integration/drone the build failed Details

pull/1/head
Jef Roosens 2021-05-22 18:41:57 +02:00
parent cffc928d2f
commit e044c07cd6
Signed by: Jef Roosens
GPG Key ID: 955C0660072F691F
9 changed files with 19 additions and 11 deletions

View File

@ -4,6 +4,7 @@ PYTHON := python3
VENV := .venv
# Minimum % coverage for tests to succeed
MIN_COV := 50
SRC := setup.py app tests
# =====GENERAL=====
@ -33,13 +34,14 @@ venv: $(VENV)/bin/activate
## Formatting & linting
### Format the codebase using black
format: venv
@ '$(VENV)'/bin/black setup.py app
@ '$(VENV)'/bin/black $(SRC)
@ '$(VENV)'/bin/isort $(SRC)
.PHONY: format
### Lint using black & flake8
lint: venv
@ '$(VENV)'/bin/flake8 setup.py app
@ '$(VENV)'/bin/black --check setup.py app
@ '$(VENV)'/bin/flake8 $(SRC)
@ '$(VENV)'/bin/black --check $(SRC)
.PHONY: lint

View File

@ -0,0 +1 @@
"""Main module for the app."""

View File

@ -1,5 +1,5 @@
"""Common exceptions raised by the program."""
from typing import Union, List
from typing import List, Union
class InvalidKeyError(Exception):

View File

@ -1,5 +1,6 @@
"""Handles merging with the skeleton config."""
from typing import Dict
from .exceptions import InvalidKeyError, MissingKeyError

View File

@ -4,3 +4,7 @@ build-backend = "setuptools.build_meta"
[tool.black]
line-length = 79
[tool.isort]
profile = "black"
multi_line_output = 3

View File

@ -22,6 +22,7 @@ lint =
flake8-docstrings==1.6.0
flake8-print==4.0.0
flake8-quotes==3.2.0
isort==5.8.0
# Required for the developer
develop =

View File

@ -1,4 +1,4 @@
"""Setup script for the package."""
import setuptools
setuptools.setup()

View File

@ -0,0 +1 @@
"""Main testing module."""

View File

@ -1,15 +1,13 @@
"""Tests wether the skeleton merge works."""
from app.skeleton import merge_with_skeleton
from app.exceptions import InvalidKeyError, MissingKeyError
import pytest
from app.exceptions import InvalidKeyError, MissingKeyError
from app.skeleton import merge_with_skeleton
def test_single_invalid_key():
"""Tests wether an InvalidKeyError is correctly thrown for a single key."""
data = {
"test": 1,
"test2": "test"
}
data = {"test": 1, "test2": "test"}
skel = {
"test": None,
}