Skip to content

Commit

Permalink
Allow BaseFuture instances to be instantiated without arguments (#467) (
Browse files Browse the repository at this point in the history
#468)

(cherry picked from commit 63005f7)
  • Loading branch information
mdickinson committed Jul 29, 2021
1 parent fa284d7 commit c34da2b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
12 changes: 12 additions & 0 deletions docs/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
Thanks for using Enthought open source!


Release 0.3.1
-------------

Release date: XXXX-XX-XX

Fixes
~~~~~

* Fix regression where |BaseFuture| subclasses could not be instantiated
without any arguments. (#467)


Release 0.3.0
-------------

Expand Down
6 changes: 3 additions & 3 deletions traits_futures/base_future.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
Bool,
Callable,
Enum,
HasRequiredTraits,
HasStrictTraits,
observe,
Property,
Str,
Expand Down Expand Up @@ -142,7 +142,7 @@ class _StateTransitionError(Exception):


@IFuture.register
class BaseFuture(HasRequiredTraits):
class BaseFuture(HasStrictTraits):
"""
Convenience base class for the various flavours of Future.
"""
Expand Down Expand Up @@ -460,7 +460,7 @@ def _user_cancelled(self):

#: Callback called (with no arguments) when user requests cancellation.
#: This is reset to ``None`` once cancellation is impossible.
_cancel = Callable(allow_none=True, required=True)
_cancel = Callable(allow_none=True)

#: The internal state of the future.
_internal_state = Enum(WAITING, list(_INTERNAL_STATE_TO_STATE))
Expand Down
5 changes: 5 additions & 0 deletions traits_futures/tests/common_future_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ def test_interface(self):
future = self.future_class(_cancel=dummy_cancel_callback)
self.assertIsInstance(future, IFuture)

def test_zero_argument_instantiation(self):
# Regression test for enthought/traits-futures#466
future = self.future_class()
self.assertIsInstance(future, IFuture)

def send_message(self, future, message, cancel_callback):
"""Send a particular message to a future."""
if message == "A":
Expand Down

0 comments on commit c34da2b

Please sign in to comment.