While the Louie system operated on weakrefs for the callback
functions, the priority list wrapper did not. This difference led to
weakrefs to callback functions being compared to strong references in
list element operations within Louie's disconnect method, so that
handler methods were not disconnected from signals.
Converting the receiver to a weakref then allowed Louie to operate as
normal, which may include deleting and re-appending the handler method
to the receivers list. As ``append`` is a dummy method that allows the
priority list implementation, the handler method is then never added
back to the list of connected functions, so we must ``add`` it after
``connect`` is called.
Also included is a testcase to confirm the proper disconnection of
signals.
Need to test:
- whether the state files properly track the state of wa
runs
- the state of the jobs and whether they are correctly
updated
State file consistency tests implemented for scenarios:
- job passes on first try
- job requires a retry
- job fails all retries
Job object state test implemented for:
- Job status should reset on job retry (from FAILED or PARTIAL
to PENDING)
Correctly handle the presence of both an element and its toggle in the
input, and handle them base on order, e.g.
toggle_set(['x', 'y', '~x']) --> {'y', '~x'}
toggle_set(['~x', 'y', 'x']) --> {'y', 'x'}
Fix warnings reported when running unit tests via pytest.
- Rename TestDevice to MockDevice, so that it is not interpreted as a
test case.
- Fix collections abstract base class imports.
- Add an ini file to ignore the same from "past".
Instead of using the default yaml loader make sure to use our customised
loader. Also move the loading stage into our test cases as this should
be part of the test case to ensure that it functions for the individual
test case.
- Change how "source" and "dest" are handled inside merge() to be more
sane and less confusing, ensuring that disabling toggles are merged
correctly.
- Do not drop disabling values during merge, to ensure that merging
is a transitive operation.
- Add unit tests for the above fixes.
- Add copyright headers to files that did not already have them
- Update the year to the last year the file was modified in files with
existing headers.
As part of commit #b3de85 porting to WA3, the behaviour of Enums changed
so that the attribute to be fetched is converted to lower case before
the lookup occurs. Due to the fact that 'names' is a predefined
attribute of the Enum class this clashes and will return the full list
of names instead of the individual entry. Update the test to use another
non reserved entry.
This should have been handled by the @total_ordering decorator, but
isn't due to
https://bugs.python.org/issue25732
(briefly, total_ordering is back-ported from Python 3, where the base
object provides the default implementation of __ne__ based on __eq__, so
total_ordering did not override it; this, however does not happen in
Python 2).
Also update unit tests to catch this edge case.
During Python 3 migration, the izip call inside diff_interrupt_files has
been replaced with a zip call (zip returning an iterator in Python 3).
Import zip from builtins to ensure that it also produces an iterator in
Python 2.
Also fix the associated unit test by importing the correct function.
The current test was designed to test the removed `Agenda` class, we now
use use an `AgendaParser` so update the tests to test its functionality
instead.
Previously the `once_per_instance` used the output of `__repr__` to
identify the class of where the decorated method was called from. For
classes that override this method to produce the same output for
different instances of the same class this caused different instances to
be mistakenly treated as one. Now use the hash of the containing class
instead of the string representation and update the tests to catch this
error.
- What used to be enum.values is now enum.levels.
- Add enum.names and enum.values that are lists of enum's levels' names
and values respectively.
- Add a check on creation to make sure that provided level names do not
conflict with the atomatically created members.
Previously there was no differentiation between the same method at different
inheritance levels, therefore using the once_per_instance_decorator with super call would
prevent the super call from executing as they were considered the same
instance.
Add to/from_pod implementations to level, so that it may be serialized
properly. In order to make sure that serialization is a reversible
operation, ensure that the level value is numeric.
Tests now reside in the root of the repo, rather than in wa package.
This means they will no longer packaged and installed in user
deployments (they're only useful for developers).