-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from akozl/master
CI config and fixes
- Loading branch information
Showing
24 changed files
with
384 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
engines: | ||
radon: | ||
enabled: true | ||
config: | ||
threshold: "B" | ||
|
||
ratings: | ||
paths: | ||
- "**.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[run] | ||
branch = True | ||
omit = | ||
*/tests/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
all: quality complexity test complexity-report coverage-report | ||
|
||
test: test-py ## Run tests | ||
|
||
test-py: unittests acceptance-tests ## Run all Python tests | ||
|
||
unittests: ## Run unit tests with coverage | ||
python setup.py nosetests --with-xunit --with-coverage --cover-package=configuration_py --cover-inclusive | ||
|
||
acceptance-tests: ## Run acceptance tests with coverage | ||
coverage run -a --source='configuration_py' -m behave --tags=~@skip --format=progress3 --junit ./configuration_py/tests/acceptance/ | ||
|
||
quality: quality-py ## Run code quality checks | ||
|
||
quality-py: | ||
pep8 . --format=pylint --max-line-length=140 --exclude=*/migrations/* --ignore=E121,E123,E24 | ||
pylint -f colorized configuration_py | ||
|
||
deps-test: ## Install dependencies required to run tests | ||
pip install -r test_requirements.txt | ||
|
||
complexity: ## Run code complexity checks | ||
xenon . -bB -mA -aA | ||
|
||
reports: complexity-report tests-report coverage-report | ||
|
||
tests-report: | ||
mkdir $(CIRCLE_TEST_REPORTS)/nosetests | ||
mkdir $(CIRCLE_TEST_REPORTS)/behave | ||
cp nosetests.xml $(CIRCLE_TEST_REPORTS)/nosetests/ | ||
cp -r reports/. $(CIRCLE_TEST_REPORTS)/behave/ | ||
|
||
complexity-report: ## Generate code complexity reports | ||
radon cc . -s | ||
radon mi . -s | ||
|
||
coverage-report: | ||
coverage report | ||
coverage html -d $(CIRCLE_ARTIFACTS)/coverage | ||
codecov | ||
|
||
help: | ||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,13 @@ | ||
machine: | ||
python: | ||
version: 2.7.11 | ||
dependencies: | ||
pre: | ||
- pip install behave sure | ||
|
||
pre: | ||
- make deps-test | ||
test: | ||
override: | ||
- mkdir -p $CIRCLE_TEST_REPORTS/nosetests | ||
- mkdir -p $CIRCLE_TEST_REPORTS/behave | ||
- python setup.py nosetests --with-xunit --xunit-file=$CIRCLE_TEST_REPORTS/nosetests/nosetests.xml --with-coverage --cover-package=configuration_py | ||
- behave --tags=~@skip --format=progress3 --junit --junit-directory $CIRCLE_TEST_REPORTS/behave/ ./configuration_py/tests/acceptance/ | ||
override: | ||
- make quality | ||
- make complexity | ||
- make test | ||
post: | ||
- make reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from configuration_load import load | ||
from configuration_load import load |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
from string import Template | ||
|
||
import os | ||
import string | ||
|
||
from configuration_py.parsers.base_parser import BaseConfigParser | ||
|
||
|
||
class ConfigStringTemplateProcessor(BaseConfigParser): | ||
|
||
extensions = 'tmpl', 'strtmpl' | ||
|
||
def parse(self, file_content, context={}): | ||
context.update(os.environ) | ||
def parse(self, file_content, context=None): | ||
context = dict(context or {}, **os.environ) | ||
try: | ||
return Template(file_content).substitute(context) | ||
except KeyError, e: | ||
return string.Template(file_content).substitute(context) | ||
except KeyError, exc: | ||
raise EnvironmentError( | ||
'Config try to use {e} variable which does not exists. Pass variable to load context ' | ||
'or set it to the environment.'.format(e=e)) | ||
'Config try to use {exc} variable which does not exists. Pass variable to load context ' | ||
'or set it to the environment.'.format(exc=exc)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
from unittest import TestCase | ||
|
||
from mock import patch | ||
|
||
from configuration_py.configuration_load import load | ||
|
||
# from unittest import TestCase | ||
# | ||
# from mock import patch | ||
# | ||
# from configuration_py.configuration_load import load | ||
|
||
# class TestGetAvailableConfigEnvList(TestCase): | ||
# @patch('configuration_py.configuration_py._normalize_environment_label', return_value={'test': ''}) | ||
# @patch('configuration_py.configuration_py._get_available_config_environments_list') | ||
# @patch('configuration_py.configuration_py._load_yaml_config_by_name') | ||
# def test_should_call_load_yaml_config_by_name_with_correct_parameters(self, load_mock, available_mock, normalize_mock): | ||
# config_name = 'test' | ||
# config_folder = './config' | ||
# load(config_name, config_name) | ||
# load_mock.assert_called_once_with(config_name, config_folder) | ||
# @patch('configuration_py.configuration_py._normalize_environment_label', return_value={'test': ''}) | ||
# @patch('configuration_py.configuration_py._get_available_config_environments_list') | ||
# @patch('configuration_py.configuration_py._load_yaml_config_by_name') | ||
# def test_should_call_load_yaml_config_by_name_with_correct_parameters(self, load_mock, available_mock, normalize_mock): | ||
# config_name = 'test' | ||
# config_folder = './config' | ||
# load(config_name, config_name) | ||
# load_mock.assert_called_once_with(config_name, config_folder) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.