Skip to content
Browse files

updated tests for new context failure handling, and initial context c…

…hecking tests
  • Loading branch information...
1 parent a6ef0eb commit 3b3e53d15f0f8a83b927310507c8fb3095d813e9 @mlaite mlaite committed Apr 22, 2010
Showing with 17 additions and 2 deletions.
  1. +17 −2 client/test_client/test_context.py
View
19 client/test_client/test_context.py
@@ -1,4 +1,5 @@
-from pony_client import Context, BaseCommand, do
+import os
+from pony_client import Context, BaseCommand, do, TempDirectoryContext
import pony_client
class StubCommand(BaseCommand):
@@ -29,7 +30,9 @@ def run(self, context):
class FailedContextInit(Context):
def __init__(self, *args, **kwargs):
Context.__init__(self, *args, **kwargs)
- pony_client.error_state = True
+ def initialize(self):
+ Context.initialize(self)
+ raise Exception("I suck too")
def test_context_failure():
c = FailedContextInit()
@@ -48,3 +51,15 @@ def test_exception_command():
(client_info, _, _) = do('foo', [ ExceptedCommand() ], context=c)
assert not client_info['success']
+
+def test_misc_TempDirectoryContext_things():
+
+ c = TempDirectoryContext()
+
+ c.initialize()
+ # test for temp folder creation
+ assert os.path.exists(c.tempdir)
+
+ c.finish()
+ # test for temp folder proper deletion
+ assert not os.path.exists(c.tempdir)

0 comments on commit 3b3e53d

Please sign in to comment.
Something went wrong with that request. Please try again.