Merge pull request #5053 from jdfreder/js-test-refact

Move&rename JS tests
Brian E. Granger 12 years ago
commit 674ce7d9f8

@ -159,6 +159,18 @@ class PyTestController(TestController):
self.cmd[2] = self.pycmd
super(PyTestController, self).launch()
js_prefix = 'js/'
def get_js_test_dir():
import IPython.html.tests as t
return os.path.join(os.path.dirname(t.__file__), '')
def all_js_groups():
import glob
test_dir = get_js_test_dir()
all_subdirs = glob.glob(test_dir + '*/')
return [js_prefix+os.path.relpath(x, test_dir) for x in all_subdirs if os.path.relpath(x, test_dir) != '__pycache__']
class JSController(TestController):
"""Run CasperJS tests """
def __init__(self, section):
@ -177,14 +189,11 @@ class JSController(TestController):
def launch(self):
# start the ipython notebook, so we get the port number
self._init_server()
import IPython.html.tests as t
test_dir = os.path.join(os.path.dirname(t.__file__), 'casperjs')
includes = '--includes=' + os.path.join(test_dir,'util.js')
test_cases = os.path.join(test_dir, 'test_cases')
js_test_dir = get_js_test_dir()
includes = '--includes=' + os.path.join(js_test_dir,'util.js')
test_cases = os.path.join(js_test_dir, self.section[len(js_prefix):])
port = '--port=' + str(self.server_port)
self.cmd = ['casperjs', 'test', port, includes, test_cases]
super(JSController, self).launch()
@property
@ -203,8 +212,6 @@ class JSController(TestController):
self.server.join()
TestController.cleanup(self)
js_test_group_names = {'js'}
def run_webapp(q, ipydir, nbdir, loglevel=0):
"""start the IPython Notebook, and pass port back to the queue"""
import os
@ -229,10 +236,13 @@ def prepare_controllers(options):
if testgroups:
py_testgroups = [g for g in testgroups if (g in py_test_group_names) \
or g.startswith('IPython.')]
js_testgroups = [g for g in testgroups if g in js_test_group_names]
if 'js' in testgroups:
js_testgroups = all_js_groups()
else:
js_testgroups = [g for g in testgroups if g not in py_testgroups]
else:
py_testgroups = py_test_group_names
js_testgroups = js_test_group_names
js_testgroups = all_js_groups()
if not options.all:
test_sections['parallel'].enabled = False

@ -166,7 +166,7 @@ def find_package_data():
static_data.append(pjoin(parent, f))
os.chdir(os.path.join('tests',))
js_tests = glob('casperjs/*.*') + glob('casperjs/*/*')
js_tests = glob('*.js') + glob('*/*.js')
os.chdir(os.path.join(cwd, 'IPython', 'nbconvert'))
nbconvert_templates = [os.path.join(dirpath, '*.*')

Loading…
Cancel
Save