From 18bf1d322ce2e63364c158f6b81cca5cba0ca1cb 2010-07-26 08:19:34 From: Fernando Perez Date: 2010-07-26 08:19:34 Subject: [PATCH] Remove invalid test runner and invalid tests. These were old IPython tests that had to be executed manually, they haven't been run in years. For %cd we've added real tests, and the runner should be removed as it doesn't really work. For completer, our real test suite has tests already. --- diff --git a/test/runtests.py b/test/runtests.py deleted file mode 100644 index 36160ab..0000000 --- a/test/runtests.py +++ /dev/null @@ -1,31 +0,0 @@ -""" Run ipython unit tests - -This should be launched from inside ipython by "%run runtests.py" -or through ipython command line "ipython runtests.py". - -""" - -from IPython.external.path import path -import pprint,os -import IPython.ipapi -ip = IPython.ipapi.get() - -def main(): - all = path('.').files('test_*py') - results = {} - res_exc = [None] - def exchook(self,*e): - res_exc[0] = [e] - ip.IP.set_custom_exc((Exception,), exchook) - startdir = os.getcwd() - for test in all: - print test - res_exc[0] = 'ok' - os.chdir(startdir) - ip.runlines(test.text()) - results[str(test)] = res_exc[0] - - os.chdir(startdir) - pprint.pprint(results) - -main() diff --git a/test/test_cd.ipy b/test/test_cd.ipy deleted file mode 100644 index eee6ace..0000000 --- a/test/test_cd.ipy +++ /dev/null @@ -1,18 +0,0 @@ -# assumes there is /tmp and /opt - -def curpath(): - cwd = os.path.splitdrive(os.getcwd())[1].replace('\\','/') - print cwd - return cwd - -import os -cd / -assert curpath() == '/' -%cd /tmp -assert curpath() == '/tmp' -pushd /opt -assert curpath() == '/opt' -popd -assert curpath() == '/tmp' - - diff --git a/test/test_completer.py b/test/test_completer.py deleted file mode 100644 index 0ba66c3..0000000 --- a/test/test_completer.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -comp -""" - -# The prefilter always ends in a call to some self.handle_X method. We swap -# all of those out so that we can capture which one was called. - -import sys -sys.path.append('..') -import IPython -import IPython.ipapi - -IPython.Shell.start() - -ip = IPython.ipapi.get() - -completer = ip.IP.Completer - -print completer - -def do_test(text, line): - def get_endix(): - idx = len(line) - print "Call endidx =>",idx - return idx - def get_line_buffer(): - print "Lbuf =>",line - return line - completer.get_line_buffer = get_line_buffer - completer.get_endidx = get_endix - l = completer.all_completions(text) - return l - -l = do_test ('p', 'print p') -assert 'pow' in l -l = do_test ('p', 'import p') -assert 'pprint' in l \ No newline at end of file