Alan Conway wrote:
Yup I knew the cleanup stuff was a bit dodgy. How does this sound:
TestBase: add these functions:
assertChannelOpen(chan): fail if chan is closed or has an exception.
assertChannelClean(chan): fail if channel has exceptions
I'm not sure whether this second one is needed. From a protocol
perspective, a channel exception *is* a channel.close i.e. if there is
an exception then it closed the channel.
It would be useful to have a means of checking this on the Channel class
itself, which may be exactly what you are proposing, with any assertion
utility method using that facility.
openChannel(id): return channel, add it to self.channelsUsed
This is to allow the channels to be tracked? Do we need this or could we
not just check the list of known channels for the client?
In unit tests:
1. Call openChannel rather than using client directly.
2. After nowait ops call assertChannelOpen (*)
In tearDown:
1. for ch in self.channelsUsed: close, note any exceptions
2. Open new channel to clean up qs and exs. note any exceptions
3. Close that channel
4. If any exceptions noted above, fail the test.
I'll implement that today unless anyone has better ideas.
Cheers,
Alan.