CS-PROJECTS / job_control / src / cd_test.py
cd_test.py
Raw
#!/usr/bin/python
#
# cd_test: tests the functionality of the cd command
# 
# Test the ability to change directories using the cd command
#
# Requires the following commands to be implemented
# or otherwise usable:
#
#	N/A. Only the ability to run jobs
#
import sys, imp, atexit, signal, time, threading
from testutils import *

tmpdir = tempfile.mkdtemp("cd_test")

console = setup_tests()

# ensure that shell prints expected prompt
expect_prompt()

# CD into the created directory
sendline("cd " + tmpdir)

# Get the cwd path
current = os.getcwd()

# echo this for comparison
sendline("echo " + current)

# Compare to created direcotry path 
expect_exact(tmpdir)

# Remove temp dir
shutil.rmtree(tmpdir)

test_success()