diff --git a/configspec/__init__.py b/configspec/__init__.py index 43538e3..1edd060 100644 --- a/configspec/__init__.py +++ b/configspec/__init__.py @@ -1,2 +1,2 @@ -from .specification import * -from .manager import * +from .specification import * # noqa +from .manager import * # noqa diff --git a/configspec/specification.py b/configspec/specification.py index e27249b..6866e2a 100644 --- a/configspec/specification.py +++ b/configspec/specification.py @@ -37,7 +37,7 @@ TOML files would fail:: from abc import ABC, abstractmethod -from preserve import preservable, restore +from preserve import preservable class InvalidConfigError(Exception): diff --git a/pytest.ini b/pytest.ini index 0d26d5b..3e988c9 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,3 @@ [pytest] -pep8maxlinelength = 99 \ No newline at end of file +addopts = --flake8 +flake8-max-line-length = 99 \ No newline at end of file diff --git a/setup.py b/setup.py index 1406cd5..f402d2b 100644 --- a/setup.py +++ b/setup.py @@ -17,8 +17,9 @@ setup(name='config-spec', 'pylint', 'autopep8', 'pytest', - 'pytest-pep8', - 'pytest-cov' + 'pytest-flake8', + 'pytest-cov', + 'pytest-sugar' ] }, long_description=open('README.md').read(), diff --git a/tests/test_configmanager.py b/tests/test_configmanager.py deleted file mode 100644 index 0f157aa..0000000 --- a/tests/test_configmanager.py +++ /dev/null @@ -1,20 +0,0 @@ -import pytest -import configspec -from copy import deepcopy -from test_configspec import example_spec, example_values - - -def test_man(example_spec, example_values): - confman = configspec.ConfigManager() - confman.add_confspec("test_bundle", example_spec) - confman.load({"test_bundle": example_values}) - assert confman.get_config_bundle("test_bundle") == example_values - - confman.freeze_value("test_bundle", "int_a") - newvals = deepcopy(example_values) - newvals["int_a"] = 4 - - confman.load({"test_bundle": newvals}) - assert confman.get_config_bundle("test_bundle") == example_values - confman.load_overlay({"test_bundle": {"string_a": "new text"}}) - assert confman.get_config_bundle("test_bundle")["string_a"] == "new text" diff --git a/tests/test_configspec.py b/tests/test_configspec.py index f0fa1ec..cb40e87 100644 --- a/tests/test_configspec.py +++ b/tests/test_configspec.py @@ -1,7 +1,6 @@ import pytest import configspec - -# Test each def type, both pass and fail +from copy import deepcopy @pytest.fixture @@ -100,4 +99,17 @@ def test_invalid_string(): spec.validate(None) -# Test manager, load, overlay, freeze +def test_man(example_spec, example_values): + confman = configspec.ConfigManager() + confman.add_confspec("test_bundle", example_spec) + confman.load({"test_bundle": example_values}) + assert confman.get_config_bundle("test_bundle") == example_values + + confman.freeze_value("test_bundle", "int_a") + newvals = deepcopy(example_values) + newvals["int_a"] = 4 + + confman.load({"test_bundle": newvals}) + assert confman.get_config_bundle("test_bundle") == example_values + confman.load_overlay({"test_bundle": {"string_a": "new text"}}) + assert confman.get_config_bundle("test_bundle")["string_a"] == "new text"