Patchwork [1,of,2,v2] tests: move mock blackbox extension into own file

login
register
mail settings
Submitter Gregory Szorc
Date April 13, 2015, 5:29 p.m.
Message ID <f8ea787cd2b077ba0c8e.1428946167@gps-mbp.local>
Download mbox | patch
Permalink /patch/8634/
State Accepted
Headers show

Comments

Gregory Szorc - April 13, 2015, 5:29 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1428932193 14400
#      Mon Apr 13 09:36:33 2015 -0400
# Node ID f8ea787cd2b077ba0c8eb6163cc69cf910842e2e
# Parent  52ff737c63d2b2cb41185549aa9c35bc47317032
tests: move mock blackbox extension into own file

Having all blackbox log testing in test-blackbox.t isn't scalable. Move
the mock blackbox extension into its own file so we can start to move
blackbox logging into other tests.

Patch

diff --git a/tests/mockblackbox.py b/tests/mockblackbox.py
new file mode 100644
--- /dev/null
+++ b/tests/mockblackbox.py
@@ -0,0 +1,11 @@ 
+from mercurial import util
+
+def makedate():
+    return 0, 0
+def getuser():
+    return 'bob'
+
+# mock the date and user apis so the output is always the same
+def uisetup(ui):
+    util.makedate = makedate
+    util.getuser = getuser
diff --git a/tests/test-blackbox.t b/tests/test-blackbox.t
--- a/tests/test-blackbox.t
+++ b/tests/test-blackbox.t
@@ -1,21 +1,9 @@ 
 setup
-  $ cat > mock.py <<EOF
-  > from mercurial import util
-  > 
-  > def makedate():
-  >     return 0, 0
-  > def getuser():
-  >     return 'bob'
-  > # mock the date and user apis so the output is always the same
-  > def uisetup(ui):
-  >     util.makedate = makedate
-  >     util.getuser = getuser
-  > EOF
   $ cat >> $HGRCPATH <<EOF
   > [extensions]
   > blackbox=
-  > mock=`pwd`/mock.py
+  > mock=$TESTDIR/mockblackbox.py
   > mq=
   > EOF
   $ hg init blackboxtest
   $ cd blackboxtest