# HG changeset patch
# User Steve Losh <steve@stevelosh.com>
# Date 1254686547 14400
# Node ID 4d7eca6c18324919d4381f2d5385ebef5a045d46
# Parent  17e0a612303e3ecb2e2bb1ffc15a730eb00e9df1
Pull out the test utils.

diff -r 17e0a612303e -r 4d7eca6c1832 review/tests/test_init.py
--- a/review/tests/test_init.py	Sun Oct 04 16:00:43 2009 -0400
+++ b/review/tests/test_init.py	Sun Oct 04 16:02:27 2009 -0400
@@ -1,38 +1,5 @@
 from nose import *
-from mercurial import commands, hg, ui
-import os, shutil
-import sample_data
-
-from .. import extension_ui
-_ui = ui.ui()
-def review(init=False, local_path='', remote_path=''):
-    return extension_ui.review(_ui, get_sandbox_repo(),
-        init=init, local_path=local_path, remote_path=remote_path)
-
-
-sandbox_path = os.path.join(os.path.realpath('.'), 'hgreview_test')
-
-def setup_sandbox():
-    os.mkdir(sandbox_path)
-    os.chdir(sandbox_path)
-    
-    commands.init(ui.ui())
-    sandbox = get_sandbox_repo()
-    
-    opts = { 'addremove': True, 'date': None, 'user': 'Review Tester',
-             'logfile': None, 'message': "Sandbox commit.", }
-    for state in sample_data.log:
-        for filename in state:
-            with open(filename, 'w') as f:
-                f.write(state[filename])
-        commands.commit(ui.ui(), sandbox, **opts)
-
-def teardown_sandbox():
-    os.chdir(os.path.realpath(os.path.join(sandbox_path, os.pardir)))
-    shutil.rmtree(sandbox_path)
-
-def get_sandbox_repo():
-    return hg.repository(ui.ui(), '.')
+from util import *
 
 
 @with_setup(setup_sandbox, teardown_sandbox)
diff -r 17e0a612303e -r 4d7eca6c1832 review/tests/util.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/review/tests/util.py	Sun Oct 04 16:02:27 2009 -0400
@@ -0,0 +1,35 @@
+import os, shutil
+import sample_data
+from mercurial import commands, hg, ui
+
+from .. import extension_ui
+_ui = ui.ui()
+def review(init=False, local_path='', remote_path=''):
+    return extension_ui.review(_ui, get_sandbox_repo(),
+        init=init, local_path=local_path, remote_path=remote_path)
+
+
+sandbox_path = os.path.join(os.path.realpath('.'), 'hgreview_test')
+
+def setup_sandbox():
+    os.mkdir(sandbox_path)
+    os.chdir(sandbox_path)
+    
+    commands.init(ui.ui())
+    sandbox = get_sandbox_repo()
+    
+    opts = { 'addremove': True, 'date': None, 'user': 'Review Tester',
+             'logfile': None, 'message': "Sandbox commit.", }
+    for state in sample_data.log:
+        for filename in state:
+            with open(filename, 'w') as f:
+                f.write(state[filename])
+        commands.commit(ui.ui(), sandbox, **opts)
+
+def teardown_sandbox():
+    os.chdir(os.path.realpath(os.path.join(sandbox_path, os.pardir)))
+    shutil.rmtree(sandbox_path)
+
+def get_sandbox_repo():
+    return hg.repository(ui.ui(), '.')
+