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:
ConfigVarTest
Mixin to add tests for
ConfigVar
s that can’t be integers.-
test_error_int
()[source] Checks that the
ConfigVar
raises aValueError
when passed anint
.
-
-
class
NotBoolTest
[source] Bases:
ConfigVarTest
Mixin to add tests for
ConfigVar
s that can’t be boolean values.-
test_error_bool
()[source] Checks that the
ConfigVar
raises aValueError
when passed abool
.
-
-
class
NotStrTest
[source] Bases:
ConfigVarTest
Mixin to add tests for
ConfigVar
s that can’t be strings.-
test_error_str
()[source] Checks that the
ConfigVar
raises aValueError
when passed astr
.
-
-
class
ListTest
[source] Bases:
NotStrTest
,NotBoolTest
,NotIntTest
,ConfigVarTest
Test 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
ConfigVar
A value that is valid and should be returned unchanged.
Methods:
Checks that the
ConfigVar
can correctly parse variouslist
values.-
default_value
= [] -
The default value that should be returned when no valid is given.
-
-
class
DirectoryTest
[source] Bases:
NotBoolTest
,NotIntTest
,ConfigVarTest
Test 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
ConfigVar
A value that is valid and should be returned unchanged.
Methods:
Checks that the
ConfigVar
raises aValueError
when passed astr
.Checks that the
ConfigVar
raises aValueError
when passed astr
.Checks that the
ConfigVar
can 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
ConfigVar
raises aValueError
when passed astr
.
-
test_error_list_str
()[source] Checks that the
ConfigVar
raises aValueError
when passed astr
.
-
-
class
BoolTrueTest
[source] Bases:
ConfigVarTest
Test for boolean configuration values which default to
True
.Attributes:
A dictionary containing one or more keys that are not the keys used by the
ConfigVar
A list of values which should be considered
False
by theConfigVar
.A list of values which should be considered
True
by 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:
BoolTrueTest
Test for boolean configuration values which default to
False
.Attributes:
A dictionary containing one or more keys that are not the keys used by the
ConfigVar
A list of values which should be considered
False
by theConfigVar
.A list of values which should be considered
True
by 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:
ConfigVarTest
Test 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:
RequiredStringTest
Test 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
ConfigVar
A list of values which should are of the wrong type.
Methods:
-
class
EnumTest
[source] Bases:
RequiredStringTest
Test for
Enum
configuration 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
,ConfigVarTest
Test 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
ConfigVar
A value that is valid and should be returned unchanged.
Methods:
-
default_value
= {} -
The default value that should be returned when no valid is given.
-