[PATCH STABLE] tests: use TESTTMP instead of TESTDIR
Sean Farley
sean.michael.farley at gmail.com
Fri Mar 28 14:50:53 CDT 2014
# HG changeset patch
# User Sean Farley <sean.michael.farley at gmail.com>
# Date 1396035207 18000
# Fri Mar 28 14:33:27 2014 -0500
# Branch stable
# Node ID 28bbe81ab07d3f80af896a96a924be21bad635b2
# Parent ccdbb91dda21f43001f86584ce7f3df35882d612
tests: use TESTTMP instead of TESTDIR
In 57d0c8c3b947, f042d4b263f4, 1e686e55780c, and 5d22cadd1938, new tests were
added that used TESTDIR instead of TESTTMP thereby leading to polluting the
working directory with these temporary files. Now, we use TESTTMP so that they
will be cleaned up properly.
diff --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -296,19 +296,19 @@ test saving last-message.txt
> EOF
$ echo 'sub = sub' > .hgsub
$ hg add .hgsub
- $ cat > $TESTDIR/editor.sh <<EOF
+ $ cat > $TESTTMP/editor.sh <<EOF
> echo "==== before editing:"
> cat \$1
> echo "===="
> echo "test saving last-message.txt" >> \$1
> EOF
$ rm -f .hg/last-message.txt
- $ HGEDITOR="sh $TESTDIR/editor.sh" hg commit -S -q
+ $ HGEDITOR="sh $TESTTMP/editor.sh" hg commit -S -q
==== before editing:
HG: Enter commit message. Lines beginning with 'HG:' are removed.
HG: Leave message empty to abort commit.
diff --git a/tests/test-histedit-fold.t b/tests/test-histedit-fold.t
--- a/tests/test-histedit-fold.t
+++ b/tests/test-histedit-fold.t
@@ -105,32 +105,32 @@ check histedit_source
check saving last-message.txt
- $ cat > $TESTDIR/abortfolding.py <<EOF
+ $ cat > $TESTTMP/abortfolding.py <<EOF
> from mercurial import util
> def abortfolding(ui, repo, hooktype, **kwargs):
> ctx = repo[kwargs.get('node')]
> if set(ctx.files()) == set(['c', 'd', 'f']):
> return True # abort folding commit only
> ui.warn('allow non-folding commit\\n')
> EOF
$ cat > .hg/hgrc <<EOF
> [hooks]
- > pretxncommit.abortfolding = python:$TESTDIR/abortfolding.py:abortfolding
+ > pretxncommit.abortfolding = python:$TESTTMP/abortfolding.py:abortfolding
> EOF
- $ cat > $TESTDIR/editor.sh << EOF
+ $ cat > $TESTTMP/editor.sh << EOF
> echo "==== before editing"
> cat \$1
> echo "===="
> echo "check saving last-message.txt" >> \$1
> EOF
$ rm -f .hg/last-message.txt
- $ HGEDITOR="sh $TESTDIR/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
+ $ HGEDITOR="sh $TESTTMP/editor.sh" hg histedit 6de59d13424a --commands - 2>&1 <<EOF | fixbundle
> pick 6de59d13424a f
> fold 9c277da72c9b d
> EOF
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
allow non-folding commit
diff --git a/tests/test-mq-qfold.t b/tests/test-mq-qfold.t
--- a/tests/test-mq-qfold.t
+++ b/tests/test-mq-qfold.t
@@ -142,33 +142,33 @@ Fold regular patch into a git patch, exp
Test saving last-message.txt:
$ hg qrefresh -m "original message"
- $ cat > $TESTDIR/commitfailure.py <<EOF
+ $ cat > $TESTTMP/commitfailure.py <<EOF
> from mercurial import util
> def reposetup(ui, repo):
> class commitfailure(repo.__class__):
> def commit(self, *args, **kwargs):
> raise util.Abort('emulating unexpected abort')
> repo.__class__ = commitfailure
> EOF
$ cat > .hg/hgrc <<EOF
> [extensions]
- > commitfailure = $TESTDIR/commitfailure.py
+ > commitfailure = $TESTTMP/commitfailure.py
> EOF
- $ cat > $TESTDIR/editor.sh << EOF
+ $ cat > $TESTTMP/editor.sh << EOF
> echo "==== before editing"
> cat \$1
> echo "===="
> (echo; echo "test saving last-message.txt") >> \$1
> EOF
$ rm -f .hg/last-message.txt
- $ HGEDITOR="sh $TESTDIR/editor.sh" hg qfold -e p3
+ $ HGEDITOR="sh $TESTTMP/editor.sh" hg qfold -e p3
==== before editing
original message====
refresh interrupted while patch was popped! (revert --all, qpush to recover)
abort: emulating unexpected abort
[255]
diff --git a/tests/test-mq-qnew.t b/tests/test-mq-qnew.t
--- a/tests/test-mq-qnew.t
+++ b/tests/test-mq-qnew.t
@@ -237,32 +237,32 @@ hg headers
Test saving last-message.txt
$ hg init repo
$ cd repo
- $ cat > $TESTDIR/commitfailure.py <<EOF
+ $ cat > $TESTTMP/commitfailure.py <<EOF
> from mercurial import util
> def reposetup(ui, repo):
> class commitfailure(repo.__class__):
> def commit(self, *args, **kwargs):
> raise util.Abort('emulating unexpected abort')
> repo.__class__ = commitfailure
> EOF
$ cat > .hg/hgrc <<EOF
> [extensions]
- > commitfailure = $TESTDIR/commitfailure.py
+ > commitfailure = $TESTTMP/commitfailure.py
> EOF
- $ cat > $TESTDIR/editor.sh << EOF
+ $ cat > $TESTTMP/editor.sh << EOF
> echo "==== before editing"
> cat \$1
> echo "===="
> echo "test saving last-message.txt" >> \$1
> EOF
$ rm -f .hg/last-message.txt
- $ HGEDITOR="sh $TESTDIR/editor.sh" hg qnew -e patch
+ $ HGEDITOR="sh $TESTTMP/editor.sh" hg qnew -e patch
==== before editing
====
abort: emulating unexpected abort
[255]
$ cat .hg/last-message.txt
More information about the Mercurial-devel
mailing list