Skip to content

Commit

Permalink
Add myoy and pre-commit to CI (#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
rochacbruno authored Aug 10, 2021
1 parent e61e293 commit 7a3f669
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 6 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ repos:
args: [--line-length=79]
language_version: python3
exclude: *exc

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.910
hooks:
- id: mypy
files: ^dynaconf/
exclude: *exc

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
SHELL := /bin/bash
.PHONY: all clean dist docs install pep8 publish run-pre-commit run-tox setup-pre-commit test test_examples test_only test_redis test_vault help coverage-report
.PHONY: all citest clean mypy dist docs install pep8 publish run-pre-commit run-tox setup-pre-commit test test_examples test_only test_redis test_vault help coverage-report

help:
@$(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'
Expand Down Expand Up @@ -155,7 +155,13 @@ test_integration:
coverage-report:
coverage report --fail-under=100

test: pep8 test_only
mypy:
mypy dynaconf/ --exclude '^dynaconf/vendor*'

test: pep8 mypy test_only

citest:
py.test -v --cov-config .coveragerc --cov=dynaconf -l tests/ --junitxml=junit/test-results.xml

test_all: test_examples test_integration test_redis test_vault test
@coverage html
Expand Down
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
versionSpec: '$(python.version)'
architecture: 'x64'

- bash: make clean install
- bash: make clean install run-pre-commit
displayName: 'Adequacy Tests'

- job: 'LinuxInstall'
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
- script: source .ci/install_dev.sh
displayName: 'Install dependencies'

- script: source .ci/test.sh
- bash: make citest
displayName: 'tests'

- script: codecov --token $(SECRET_CODECOV_TOKEN)
Expand Down
7 changes: 5 additions & 2 deletions dynaconf/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,8 +390,9 @@ def register(self, *args: Validator, **kwargs: Validator):
def descriptions(
self, flat: bool = False
) -> Dict[str, Union[str, List[str]]]:

if flat:
descriptions = {}
descriptions: Dict[str, Union[str, List[str]]] = {}
else:
descriptions = defaultdict(list)

Expand All @@ -402,7 +403,9 @@ def descriptions(
if flat:
descriptions.setdefault(name, validator.description)
else:
descriptions[name].append(validator.description)
descriptions[name].append( # type: ignore
validator.description
)
return descriptions

def validate(
Expand Down
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ flake8-print
flake8-todo
radon
pre-commit
mypy

# tools
ipython
Expand Down

0 comments on commit 7a3f669

Please sign in to comment.