The original purpose of thie PR was to add some substrate for use by David in foursight-core and probably elsewhere in 4dn-cloud-infra. We've had a number of needs for both the classproperty and Singleton support.
In the process, I brought misc_utils coverage up to 100% and fixed a few tiny and probably inconsequential bugs that I noticed when adding those tests.
In misc_utils:
New decorator @classproperty
New decorator @classproperty_cached
New decorator @classproperty_cached_each_subclass
New class Singleton. Users of SingletonManager might prefer this, but we'll continue to support both. (No deprecation for now.)
In function is_valid_absolute_uri, better handling of argument type errors.
For CachedField:
Added a handler for __str__ that returns useful information, which can also be used for __repr__.
Fixed handler for __repr__ to return a properly executable expression (shared with __str__).
Improved test coverage by adding tests for some parts of the code that were not previously tested.
In qa_utils:
New class MockId for mocking the id function in a predictable way.
Adjust MOCK_QUEUE_URL_PREFIX to use a mocked URL that looks more like modern AWS url, where queue.amazonaws.com has been replaced by sqs.us-east-1.amazonaws.com.
The original purpose of thie PR was to add some substrate for use by David in
foursight-core
and probably elsewhere in4dn-cloud-infra
. We've had a number of needs for both theclassproperty
andSingleton
support.In the process, I brought
misc_utils
coverage up to 100% and fixed a few tiny and probably inconsequential bugs that I noticed when adding those tests.In
misc_utils
:New decorator
@classproperty
New decorator
@classproperty_cached
New decorator
@classproperty_cached_each_subclass
New class
Singleton
. Users ofSingletonManager
might prefer this, but we'll continue to support both. (No deprecation for now.)In function
is_valid_absolute_uri
, better handling of argument type errors.For
CachedField
:Added a handler for
__str__
that returns useful information, which can also be used for__repr__
.Fixed handler for
__repr__
to return a properly executable expression (shared with__str__
).Improved test coverage by adding tests for some parts of the code that were not previously tested.
In
qa_utils
:New class
MockId
for mocking theid
function in a predictable way.Adjust
MOCK_QUEUE_URL_PREFIX
to use a mocked URL that looks more like modern AWS url, wherequeue.amazonaws.com
has been replaced bysqs.us-east-1.amazonaws.com
.