summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornoah <noah@656d521f-e311-0410-88e0-e7920216d269>2003-04-10 20:50:39 +0000
committernoah <noah@656d521f-e311-0410-88e0-e7920216d269>2003-04-10 20:50:39 +0000
commit67bb588e66122c9622726d838960c8cf9f9b560e (patch)
treec372e11a57d7485c306b329786683c3ba57e18ba
parent3d8d0445644d0143fd4962f64cecdbf06bdf391c (diff)
downloadpexpect-67bb588e66122c9622726d838960c8cf9f9b560e.tar.gz
Add support to make tests more directory independent.
See new cvs.conf, PROJECT_HOME_PEXPECT. git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@174 656d521f-e311-0410-88e0-e7920216d269
-rw-r--r--pexpect/cvs.conf3
-rwxr-xr-xpexpect/tests/test_filedescriptor.py8
2 files changed, 10 insertions, 1 deletions
diff --git a/pexpect/cvs.conf b/pexpect/cvs.conf
index c729617..27e618c 100644
--- a/pexpect/cvs.conf
+++ b/pexpect/cvs.conf
@@ -1,6 +1,9 @@
# Source this file to work on the project.
+# You should source this from the project root directory
+# in order to make tests work properly.
export CVS_RSH=ssh
export CVSROOT=:ext:noah@cvs.pexpect.sourceforge.net:/cvsroot/pexpect
export PATH=$PATH:tools/
+export PROJECT_PEXPECT_HOME=`pwd`
alias sf="ssh noah@use-pr-shell1.sourceforge.net"
diff --git a/pexpect/tests/test_filedescriptor.py b/pexpect/tests/test_filedescriptor.py
index c5465e5..205d898 100755
--- a/pexpect/tests/test_filedescriptor.py
+++ b/pexpect/tests/test_filedescriptor.py
@@ -5,6 +5,12 @@ import sys
import os
class ExpectTestCase(unittest.TestCase):
+ def setUp(self):
+ self.original_path = os.getcwd()
+ newpath = os.path.join (os.environ['PROJECT_PEXPECT_HOME'], 'tests')
+ os.chdir (newpath)
+ def tearDown(self):
+ os.chdir (self.original_path)
def test_fd (self):
fd = os.open ('TESTDATA.txt', os.O_RDONLY)
@@ -24,7 +30,7 @@ class ExpectTestCase(unittest.TestCase):
fd = os.open ('TESTDATA.txt', os.O_RDONLY)
s = pexpect.spawn (fd)
assert not s.isatty()
- s.close()
+ os.close(fd)
def test_close_does_not_close_fd (self):
"""Calling close() on a pexpect.spawn object should not