From b77c89ac6092f34a8c23dac0f936922080bf630a Mon Sep 17 00:00:00 2001
From: Zooko O'Whielacronx <zooko@zooko.com>
Date: Thu, 22 Jan 2009 15:52:40 -0700
Subject: [PATCH] setup: add test that the tests are testing the right source
 code This is a test of #145, and I think that now the code passes this test.

---
 src/allmydata/test/test_runner.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/allmydata/test/test_runner.py b/src/allmydata/test/test_runner.py
index 752e80c6..34def046 100644
--- a/src/allmydata/test/test_runner.py
+++ b/src/allmydata/test/test_runner.py
@@ -9,6 +9,20 @@ from allmydata.scripts import runner
 from allmydata.util import fileutil, pollmixin
 
 from allmydata.test import common_util
+import allmydata
+
+class TheRightCode(unittest.TestCase, common_util.SignalMixin):
+    def test_path(self):
+        d = utils.getProcessOutputAndValue(os.path.join("..", "bin", "tahoe"), args=["--version-and-path"], env=os.environ)
+        def _cb(res):
+            out, err, rc_or_sig = res
+            self.failUnlessEqual(rc_or_sig, 0)
+
+            # Fail unless the allmydata-tahoe package is *this* version *and* was loaded from *this* source directory.
+            required_ver_and_path = "allmydata-tahoe: %s (%s)" % (allmydata.__version__, os.path.dirname(os.path.dirname(allmydata.__file__)))
+            self.failUnless(out.startswith(required_ver_and_path), (out, err, rc_or_sig))
+        d.addCallback(_cb)
+        return d
 
 class CreateNode(unittest.TestCase, common_util.SignalMixin):
     def workdir(self, name):
-- 
2.45.2