# you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """PROTOTYPE: Demo of better stacktraces for async calls. Based on defer.inlineCallbacks.""" from greplin.defer import time from greplin.defer.thread import install, stacktrace, AsyncFrame install() from twisted.internet import defer, reactor @defer.inlineCallbacks def demo(): """Main demo function.""" yield countdown(4) @defer.inlineCallbacks def countdown(i): """Countdown function to generate chained asynchronous calls.""" if not i:
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Net enabled tests for context tracking.""" from greplin.defer import thread, time thread.install() from twisted.internet import defer, threads from twisted.web import client import unittest class ContextTrackerTest(unittest.TestCase): """Test the context tracking system.""" @defer.inlineCallbacks def testInlineCallbacks(self): """Test context saving across I/O."""