configconfig.testing¶
Helpers for testing ConfigVar.
Attention
This module has the following additional requirement:
pytest
This can be installed as follows:
python -m pip install configconfig[testing]
New in version 0.2.0.
Classes:
Test for boolean configuration values which default to |
|
Test for boolean configuration values which default to |
|
Base class for tests of |
|
|
Test for dictionary configuration values. |
Test for configuration values which represent directories. |
|
|
Test for |
|
Test for list configuration values. |
Mixin to add tests for |
|
Mixin to add tests for |
|
Mixin to add tests for |
|
Test for string configuration values which are optional. |
|
Test for string configuration values which are required. |
-
class
NotIntTest[source]¶ Bases:
ConfigVarTestMixin to add tests for
ConfigVars that can’t be integers.-
test_error_int()[source]¶ Checks that the
ConfigVarraises aValueErrorwhen passed anint.
-
-
class
NotBoolTest[source]¶ Bases:
ConfigVarTestMixin to add tests for
ConfigVars that can’t be boolean values.-
test_error_bool()[source]¶ Checks that the
ConfigVarraises aValueErrorwhen passed abool.
-
-
class
NotStrTest[source]¶ Bases:
ConfigVarTestMixin to add tests for
ConfigVars that can’t be strings.-
test_error_str()[source]¶ Checks that the
ConfigVarraises aValueErrorwhen passed astr.
-
-
class
ListTest[source]¶ Bases:
NotStrTest,NotBoolTest,NotIntTest,ConfigVarTestTest for list configuration values.
Attributes:
The default value that should be returned when no valid is given.
A dictionary containing one or more keys that are not the keys used by the
ConfigVarA value that is valid and should be returned unchanged.
Methods:
Checks that the
ConfigVarcan correctly parse variouslistvalues.-
default_value= []¶ -
The default value that should be returned when no valid is given.
-
-
class
DirectoryTest[source]¶ Bases:
NotBoolTest,NotIntTest,ConfigVarTestTest for configuration values which represent directories.
Attributes:
The default value that should be returned when no valid is given.
A dictionary containing one or more keys that are not the keys used by the
ConfigVarA value that is valid and should be returned unchanged.
Methods:
Checks that the
ConfigVarraises aValueErrorwhen passed astr.Checks that the
ConfigVarraises aValueErrorwhen passed astr.Checks that the
ConfigVarcan correctly parse various directory values.-
different_key_value= {'username': 'domdfcoding'}¶ -
A dictionary containing one or more keys that are not the keys used by the
ConfigVar
-
test_error_list_int()[source]¶ Checks that the
ConfigVarraises aValueErrorwhen passed astr.
-
test_error_list_str()[source]¶ Checks that the
ConfigVarraises aValueErrorwhen passed astr.
-
-
class
BoolTrueTest[source]¶ Bases:
ConfigVarTestTest for boolean configuration values which default to
True.Attributes:
A dictionary containing one or more keys that are not the keys used by the
ConfigVarA list of values which should be considered
Falseby theConfigVar.A list of values which should be considered
Trueby theConfigVar.A list of values which should are of the wrong type.
Methods:
-
different_key_value= {'username': 'domdfcoding'}¶ -
A dictionary containing one or more keys that are not the keys used by the
ConfigVar
-
-
class
BoolFalseTest[source]¶ Bases:
BoolTrueTestTest for boolean configuration values which default to
False.Attributes:
A dictionary containing one or more keys that are not the keys used by the
ConfigVarA list of values which should be considered
Falseby theConfigVar.A list of values which should be considered
Trueby theConfigVar.Methods:
-
different_key_value= {'username': 'domdfcoding'}¶ -
A dictionary containing one or more keys that are not the keys used by the
ConfigVar
-
-
class
RequiredStringTest[source]¶ Bases:
ConfigVarTestTest for string configuration values which are required.
Methods:
Attributes:
A value that is valid and should be returned unchanged.
A list of values which should are of the wrong type.
-
class
OptionalStringTest[source]¶ Bases:
RequiredStringTestTest for string configuration values which are optional.
Attributes:
The default value that should be returned when no valid is given.
A dictionary containing one or more keys that are not the keys used by the
ConfigVarA list of values which should are of the wrong type.
Methods:
-
class
EnumTest[source]¶ Bases:
RequiredStringTestTest for
Enumconfiguration values.Attributes:
The default value that should be returned when no valid is given.
A list of values which are of the correct type but are invalid.
Methods:
-
class
DictTest[source]¶ Bases:
NotStrTest,NotBoolTest,NotIntTest,ConfigVarTestTest for dictionary configuration values.
Attributes:
The default value that should be returned when no valid is given.
A dictionary containing one or more keys that are not the keys used by the
ConfigVarA value that is valid and should be returned unchanged.
Methods:
-
default_value= {}¶ -
The default value that should be returned when no valid is given.
-