From 0331faae066fe102c5739ccf93bdb4508042cfeb Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Wed, 29 Jul 2009 02:13:26 -0700 Subject: [PATCH 1/4] Small fixes for wx-dependent tests and include clearcmd. Check that wx.aui can be imported and otherwise exclude modules that use it to avoid errors when loading the test suite. Also, do load clearcmd so that the tests for %clear do work. --- IPython/testing/iptest.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 02aa77a81..5ea906f95 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -50,6 +50,7 @@ def test_for(mod): have_curses = test_for('_curses') have_wx = test_for('wx') +have_wx_aui = test_for('wx.aui') have_zi = test_for('zope.interface') have_twisted = test_for('twisted') have_foolscap = test_for('foolscap') @@ -65,14 +66,15 @@ EXCLUDE = [pjoin('IPython', 'external'), pjoin('IPython_doctest_plugin'), pjoin('IPython', 'Gnuplot'), pjoin('IPython', 'Extensions', 'ipy_'), - pjoin('IPython', 'Extensions', 'clearcmd'), + pjoin('IPython', 'Extensions', 'PhysicalQInput'), pjoin('IPython', 'Extensions', 'PhysicalQInteractive'), + pjoin('IPython', 'Extensions', 'InterpreterPasteInput'), pjoin('IPython', 'Extensions', 'scitedirector'), pjoin('IPython', 'Extensions', 'numeric_formats'), pjoin('IPython', 'testing', 'attic'), pjoin('IPython', 'testing', 'tutils'), pjoin('IPython', 'testing', 'tools'), - pjoin('IPython', 'testing', 'mkdoctests') + pjoin('IPython', 'testing', 'mkdoctests'), ] if not have_wx: @@ -80,6 +82,9 @@ if not have_wx: EXCLUDE.append(pjoin('IPython', 'gui')) EXCLUDE.append(pjoin('IPython', 'frontend', 'wx')) +if not have_wx_aui: + EXCLUDE.append(pjoin('IPython', 'gui', 'wx', 'wxIPython')) + if not have_objc: EXCLUDE.append(pjoin('IPython', 'frontend', 'cocoa')) @@ -258,7 +263,7 @@ def run_iptestall(): t_start = time.time() for name,runner in runners.iteritems(): print '*'*77 - print 'IPython test set:',name + print 'IPython test group:',name res = runner.run() if res: failed[name] = res @@ -269,14 +274,14 @@ def run_iptestall(): # summarize results print print '*'*77 - print 'Ran %s test sets in %.3fs' % (nrunners, t_tests) + print 'Ran %s test groups in %.3fs' % (nrunners, t_tests) print if not failed: print 'OK' else: # If anything went wrong, point out what command to rerun manually to # see the actual errors and individual summary - print 'ERROR - %s out of %s test sets failed.' % (nfail, nrunners) + print 'ERROR - %s out of %s test groups failed.' % (nfail, nrunners) for name in failed: failed_runner = runners[name] print '-'*40 @@ -297,4 +302,4 @@ def main(): if __name__ == '__main__': - main() \ No newline at end of file + main() From b7d773553dee4e8b1549e7ce41cac6654c02f994 Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Thu, 30 Jul 2009 18:16:44 -0700 Subject: [PATCH 2/4] Update setup and support tools to include new man pages. --- setup.py | 30 +++++++++++++++++++++++++++--- setupbase.py | 25 +++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 1c905c4fa..27d2db50d 100755 --- a/setup.py +++ b/setup.py @@ -78,14 +78,38 @@ if len(sys.argv) >= 2 and sys.argv[1] in ('sdist','bdist_rpm'): #('docs/magic.tex', #['IPython/Magic.py'], #"cd doc && ./update_magic.sh" ), - + + ('docs/man/ipcluster.1.gz', + ['docs/man/ipcluster.1'], + 'cd docs/man && gzip -9c ipcluster.1 > ipcluster.1.gz'), + + ('docs/man/ipcontroller.1.gz', + ['docs/man/ipcontroller.1'], + 'cd docs/man && gzip -9c ipcontroller.1 > ipcontroller.1.gz'), + + ('docs/man/ipengine.1.gz', + ['docs/man/ipengine.1'], + 'cd docs/man && gzip -9c ipengine.1 > ipengine.1.gz'), + ('docs/man/ipython.1.gz', ['docs/man/ipython.1'], - "cd docs/man && gzip -9c ipython.1 > ipython.1.gz"), + 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz'), + + ('docs/man/ipython-wx.1.gz', + ['docs/man/ipython-wx.1'], + 'cd docs/man && gzip -9c ipython-wx.1 > ipython-wx.1.gz'), + + ('docs/man/ipythonx.1.gz', + ['docs/man/ipythonx.1'], + 'cd docs/man && gzip -9c ipythonx.1 > ipythonx.1.gz'), + + ('docs/man/irunner.1.gz', + ['docs/man/irunner.1'], + 'cd docs/man && gzip -9c irunner.1 > irunner.1.gz'), ('docs/man/pycolor.1.gz', ['docs/man/pycolor.1'], - "cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz"), + 'cd docs/man && gzip -9c pycolor.1 > pycolor.1.gz'), ] # Only build the docs if sphinx is present diff --git a/setupbase.py b/setupbase.py index 9c00a35d3..94a1ca72e 100644 --- a/setupbase.py +++ b/setupbase.py @@ -212,6 +212,31 @@ def find_data_files(): return data_files + +def make_man_update_target(manpage): + """Return a target_update-compliant tuple for the given manpage. + + Parameters + ---------- + manpage : string + Name of the manpage, must include the section number (trailing number). + + Example + ------- + + >>> make_man_update_target('ipython.1') #doctest: +NORMALIZE_WHITESPACE + ('docs/man/ipython.1.gz', + ['docs/man/ipython.1'], + 'cd docs/man && gzip -9c ipython.1 > ipython.1.gz') + """ + man_dir = pjoin('docs', 'man') + manpage_gz = manpage + '.gz' + manpath = pjoin(man_dir, manpage) + manpath_gz = pjoin(man_dir, manpage_gz) + gz_cmd = ( "cd %(man_dir)s && gzip -9c %(manpage)s > %(manpage_gz)s" % + locals() ) + return (manpath_gz, [manpath], gz_cmd) + #--------------------------------------------------------------------------- # Find scripts #--------------------------------------------------------------------------- From f64ae7afe9f285bd00c740976b4e65604301a211 Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Sat, 1 Aug 2009 17:08:32 -0700 Subject: [PATCH 3/4] Make iptest more reliable under Win32. This ensures the trial part of the tests runs in win32. --- IPython/testing/iptest.py | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 5ea906f95..0f347d24e 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -24,6 +24,7 @@ import os import os.path as path import sys import subprocess +import tempfile import time import warnings @@ -190,9 +191,29 @@ class IPTester(object): # Assemble call self.call_args = self.runner+self.params - def run(self): - """Run the stored commands""" - return subprocess.call(self.call_args) + if sys.platform == 'win32': + def run(self): + """Run the stored commands""" + # On Windows, cd to temporary directory to run tests. Otherwise, + # Twisted's trial may not be able to execute 'trial IPython', since + # it will confuse the IPython module name with the ipython + # execution scripts, because the windows file system isn't case + # sensitive. + # We also use os.system instead of subprocess.call, because I was + # having problems with subprocess and I just don't know enough + # about win32 to debug this reliably. Os.system may be the 'old + # fashioned' way to do it, but it works just fine. If someone + # later can clean this up that's fine, as long as the tests run + # reliably in win32. + curdir = os.getcwd() + os.chdir(tempfile.gettempdir()) + stat = os.system(' '.join(self.call_args)) + os.chdir(curdir) + return stat + else: + def run(self): + """Run the stored commands""" + return subprocess.call(self.call_args) def make_runners(): From 2f50493d06b3a3a8ae802706c67c0d3459065caa Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Mon, 3 Aug 2009 18:18:28 -0700 Subject: [PATCH 4/4] Fixes so the test suite runs when Twisted is not available. Other minor cleanups (formatting and unused imports) --- IPython/testing/iptest.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 0f347d24e..48ed1e796 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -107,6 +107,23 @@ if not os.name == 'posix': if not have_pexpect: EXCLUDE.append(pjoin('IPython', 'irunner')) +if not have_twisted: + EXCLUDE.append(pjoin('IPython', 'frontend', 'asyncfrontendbase')) + EXCLUDE.append(pjoin('IPython', 'frontend', 'prefilterfrontend')) + EXCLUDE.append(pjoin('IPython', 'frontend', 'frontendbase')) + EXCLUDE.append(pjoin('IPython', 'frontend', 'linefrontendbase')) + EXCLUDE.append(pjoin('IPython', 'frontend', 'tests', 'test_linefrontend')) + EXCLUDE.append(pjoin('IPython', 'frontend', 'tests', 'test_frontendbase')) + EXCLUDE.append(pjoin('IPython', 'frontend', 'tests', + 'test_prefilterfrontend')) + EXCLUDE.append(pjoin('IPython', 'frontend', 'tests', + 'test_asyncfrontendbase')) + EXCLUDE.append(pjoin('IPython', 'kernel', 'error')) + EXCLUDE.append(pjoin('IPython', 'testing', 'parametric')) + EXCLUDE.append(pjoin('IPython', 'testing', 'util')) + EXCLUDE.append(pjoin('IPython', 'testing', 'tests', 'test_decorators_trial')) + + # This is needed for the reg-exp to match on win32 in the ipdoctest plugin. if sys.platform == 'win32': EXCLUDE = [s.replace('\\','\\\\') for s in EXCLUDE] @@ -232,12 +249,15 @@ def make_runners(): 'Logger.py', 'macro.py', 'Magic.py', 'OInspect.py', 'OutputTrap.py', 'platutils.py', 'prefilter.py', 'Prompts.py', 'PyColorize.py', 'Release.py', 'rlineimpl.py', 'shadowns.py', - 'shellglobals.py', 'strdispatch.py', 'twshell.py', + 'shellglobals.py', 'strdispatch.py', 'ultraTB.py', 'upgrade_dir.py', 'usage.py', 'wildcard.py', # See note above for why this is skipped # 'Shell.py', 'winconsole.py'] + if have_twisted: + top_mod.append('twshell.py') + if have_pexpect: top_mod.append('irunner.py')