Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Removed Twisted related things from setup scripts and testing.

  • Loading branch information...
commit bc1fe4f9c5fc30d9f543b908d09b01f533608193 1 parent b837f10
@ellisonbg authored
View
132 IPython/testing/decorators_trial.py
@@ -1,132 +0,0 @@
-# encoding: utf-8
-"""
-Testing related decorators for use with twisted.trial.
-
-The decorators in this files are designed to follow the same API as those
-in the decorators module (in this same directory). But they can be used
-with twisted.trial
-"""
-
-#-----------------------------------------------------------------------------
-# Copyright (C) 2008-2009 The IPython Development Team
-#
-# Distributed under the terms of the BSD License. The full license is in
-# the file COPYING, distributed as part of this software.
-#-----------------------------------------------------------------------------
-
-#-----------------------------------------------------------------------------
-# Imports
-#-----------------------------------------------------------------------------
-
-import os
-import sys
-
-from IPython.testing.decorators import make_label_dec
-
-#-----------------------------------------------------------------------------
-# Testing decorators
-#-----------------------------------------------------------------------------
-
-
-def skipif(skip_condition, msg=None):
- """Create a decorator that marks a test function for skipping.
-
- The is a decorator factory that returns a decorator that will
- conditionally skip a test based on the value of skip_condition. The
- skip_condition argument can either be a boolean or a callable that returns
- a boolean.
-
- Parameters
- ----------
- skip_condition : boolean or callable
- If this evaluates to True, the test is skipped.
- msg : str
- The message to print if the test is skipped.
-
- Returns
- -------
- decorator : function
- The decorator function that can be applied to the test function.
- """
-
- def skip_decorator(f):
-
- # Allow for both boolean or callable skip conditions.
- if callable(skip_condition):
- skip_val = lambda : skip_condition()
- else:
- skip_val = lambda : skip_condition
-
- if msg is None:
- out = 'Test skipped due to test condition.'
- else:
- out = msg
- final_msg = "Skipping test: %s. %s" % (f.__name__,out)
-
- if skip_val():
- f.skip = final_msg
-
- return f
- return skip_decorator
-
-
-def skip(msg=None):
- """Create a decorator that marks a test function for skipping.
-
- This is a decorator factory that returns a decorator that will cause
- tests to be skipped.
-
- Parameters
- ----------
- msg : str
- Optional message to be added.
-
- Returns
- -------
- decorator : function
- Decorator, which, when applied to a function, sets the skip
- attribute of the function causing `twisted.trial` to skip it.
- """
-
- return skipif(True,msg)
-
-
-def numpy_not_available():
- """Can numpy be imported? Returns true if numpy does NOT import.
-
- This is used to make a decorator to skip tests that require numpy to be
- available, but delay the 'import numpy' to test execution time.
- """
- try:
- import numpy
- np_not_avail = False
- except ImportError:
- np_not_avail = True
-
- return np_not_avail
-
-#-----------------------------------------------------------------------------
-# Decorators for public use
-#-----------------------------------------------------------------------------
-
-# Decorators to skip certain tests on specific platforms.
-skip_win32 = skipif(sys.platform == 'win32',
- "This test does not run under Windows")
-skip_linux = skipif(sys.platform == 'linux2',
- "This test does not run under Linux")
-skip_osx = skipif(sys.platform == 'darwin',"This test does not run under OS X")
-
-# Decorators to skip tests if not on specific platforms.
-skip_if_not_win32 = skipif(sys.platform != 'win32',
- "This test only runs under Windows")
-skip_if_not_linux = skipif(sys.platform != 'linux2',
- "This test only runs under Linux")
-skip_if_not_osx = skipif(sys.platform != 'darwin',
- "This test only runs under OSX")
-
-# Other skip decorators
-skipif_not_numpy = skipif(numpy_not_available,"This test requires numpy")
-
-skip_known_failure = skip('This test is known to fail')
-
-
View
32 IPython/testing/iptest.py
@@ -5,15 +5,13 @@
itself from the command line. There are two ways of running this script:
1. With the syntax `iptest all`. This runs our entire test suite by
- calling this script (with different arguments) or trial recursively. This
+ calling this script (with different arguments) recursively. This
causes modules and package to be tested in different processes, using nose
or trial where appropriate.
2. With the regular nose syntax, like `iptest -vvs IPython`. In this form
the script simply calls nose, but with special command line flags and
plugins loaded.
-For now, this script requires that both nose and twisted are installed. This
-will change in the future.
"""
#-----------------------------------------------------------------------------
@@ -101,9 +99,6 @@ def test_for(mod):
have['curses'] = test_for('_curses')
have['wx'] = test_for('wx')
have['wx.aui'] = test_for('wx.aui')
-have['zope.interface'] = test_for('zope.interface')
-have['twisted'] = test_for('twisted')
-have['foolscap'] = test_for('foolscap')
have['pexpect'] = test_for('pexpect')
#-----------------------------------------------------------------------------
@@ -183,16 +178,6 @@ def make_exclude():
exclusions.extend([ipjoin('scripts', 'irunner'),
ipjoin('lib', 'irunner')])
- # This is scary. We still have things in frontend and testing that
- # are being tested by nose that use twisted. We need to rethink
- # how we are isolating dependencies in testing.
- if not (have['twisted'] and have['zope.interface'] and have['foolscap']):
- exclusions.extend(
- [ipjoin('testing', 'parametric'),
- ipjoin('testing', 'util'),
- ipjoin('testing', 'tests', 'test_decorators_trial'),
- ] )
-
# This is needed for the reg-exp to match on win32 in the ipdoctest plugin.
if sys.platform == 'win32':
exclusions = [s.replace('\\','\\\\') for s in exclusions]
@@ -218,9 +203,6 @@ def __init__(self, runner='iptest', params=None):
if runner == 'iptest':
iptest_app = get_ipython_module_path('IPython.testing.iptest')
self.runner = pycmd2argv(iptest_app) + sys.argv[1:]
- elif runner == 'trial':
- # For trial, it needs to be installed system-wide
- self.runner = pycmd2argv(p.abspath(find_cmd('trial')))
else:
raise Exception('Not a valid test runner: %s' % repr(runner))
if params is None:
@@ -291,27 +273,15 @@ def make_runners():
# Packages to be tested via nose, that only depend on the stdlib
nose_pkg_names = ['config', 'core', 'extensions', 'frontend', 'lib',
'scripts', 'testing', 'utils' ]
- # The machinery in kernel needs twisted for real testing
- trial_pkg_names = []
-
- # And add twisted ones if conditions are met
- if have['zope.interface'] and have['twisted'] and have['foolscap']:
- # We only list IPython.kernel for testing using twisted.trial as
- # nose and twisted.trial have conflicts that make the testing system
- # unstable.
- trial_pkg_names.append('kernel')
# For debugging this code, only load quick stuff
#nose_pkg_names = ['core', 'extensions'] # dbg
- #trial_pkg_names = [] # dbg
# Make fully qualified package names prepending 'IPython.' to our name lists
nose_packages = ['IPython.%s' % m for m in nose_pkg_names ]
- trial_packages = ['IPython.%s' % m for m in trial_pkg_names ]
# Make runners
runners = [ (v, IPTester('iptest', params=v)) for v in nose_packages ]
- runners.extend([ (v, IPTester('trial', params=v)) for v in trial_packages ])
return runners
View
78 IPython/testing/parametric.py
@@ -1,78 +0,0 @@
-"""Parametric testing on top of twisted.trial.unittest.
-
-XXX - It may be possbile to deprecate this in favor of the new, cleaner
-parametric code. We just need to double-check that the new code doesn't clash
-with Twisted (we know it works with nose and unittest).
-"""
-
-#-----------------------------------------------------------------------------
-# Copyright (C) 2009 The IPython Development Team
-#
-# Distributed under the terms of the BSD License. The full license is in
-# the file COPYING, distributed as part of this software.
-#-----------------------------------------------------------------------------
-
-#-----------------------------------------------------------------------------
-# Imports
-#-----------------------------------------------------------------------------
-
-
-from twisted.trial.unittest import TestCase
-
-#-----------------------------------------------------------------------------
-# Classes and functions
-#-----------------------------------------------------------------------------
-
-__all__ = ['parametric','Parametric']
-
-
-def partial(f, *partial_args, **partial_kwargs):
- """Generate a partial class method.
-
- """
- def partial_func(self, *args, **kwargs):
- dikt = dict(kwargs)
- dikt.update(partial_kwargs)
- return f(self, *(partial_args+args), **dikt)
-
- return partial_func
-
-
-def parametric(f):
- """Mark f as a parametric test.
-
- """
- f._parametric = True
- return classmethod(f)
-
-
-def Parametric(cls):
- """Register parametric tests with a class.
-
- """
- # Walk over all tests marked with @parametric
- test_generators = [getattr(cls,f) for f in dir(cls)
- if f.startswith('test')]
- test_generators = [m for m in test_generators if hasattr(m,'_parametric')]
- for test_gen in test_generators:
- test_name = test_gen.func_name
-
- # Insert a new test for each parameter
- for n,test_and_params in enumerate(test_gen()):
- test_method = test_and_params[0]
- test_params = test_and_params[1:]
-
- # Here we use partial (defined above), which returns a
- # class method of type ``types.FunctionType``, unlike
- # functools.partial which returns a function of type
- # ``functools.partial``.
- partial_func = partial(test_method,*test_params)
- # rename the test to look like a testcase
- partial_func.__name__ = 'test_' + partial_func.__name__
-
- # insert the new function into the class as a test
- setattr(cls, test_name + '_%s' % n, partial_func)
-
- # rename test generator so it isn't called again by nose
- test_gen.im_func.func_name = '__done_' + test_name
-
View
32 IPython/testing/tests/test_decorators.py
@@ -185,35 +185,3 @@ def test_win32():
def test_osx():
nt.assert_not_equals(sys.platform,'darwin',"This test can't run under osx")
-
-# Verify that the same decorators work for methods.
-# Note: this code is identical to that in test_decorators_trial, but that one
-# uses twisted's unittest, not the one from the stdlib, which we are using
-# here. While somewhat redundant, we want to check both with the stdlib and
-# with twisted, so the duplication is OK.
-class TestDecoratorsTrial(unittest.TestCase):
-
- @dec.skip()
- def test_deliberately_broken(self):
- """A deliberately broken test - we want to skip this one."""
- 1/0
-
- @dec.skip('Testing the skip decorator')
- def test_deliberately_broken2(self):
- """Another deliberately broken test - we want to skip this one."""
- 1/0
-
- @dec.skip_linux
- def test_linux(self):
- self.assertNotEquals(sys.platform, 'linux2',
- "This test can't run under linux")
-
- @dec.skip_win32
- def test_win32(self):
- self.assertNotEquals(sys.platform, 'win32',
- "This test can't run under windows")
-
- @dec.skip_osx
- def test_osx(self):
- self.assertNotEquals(sys.platform, 'darwin',
- "This test can't run under osx")
View
52 IPython/testing/tests/test_decorators_trial.py
@@ -1,52 +0,0 @@
-# encoding: utf-8
-"""
-Tests for decorators_trial.py
-"""
-
-#-----------------------------------------------------------------------------
-# Copyright (C) 2008-2009 The IPython Development Team
-#
-# Distributed under the terms of the BSD License. The full license is in
-# the file COPYING, distributed as part of this software.
-#-----------------------------------------------------------------------------
-
-#-----------------------------------------------------------------------------
-# Imports
-#-----------------------------------------------------------------------------
-
-# Tell nose to skip this module
-__test__ = {}
-
-import os
-import sys
-
-from twisted.trial import unittest
-import IPython.testing.decorators_trial as dec
-
-#-----------------------------------------------------------------------------
-# Tests
-#-----------------------------------------------------------------------------
-
-class TestDecoratorsTrial(unittest.TestCase):
-
- @dec.skip()
- def test_deliberately_broken(self):
- """A deliberately broken test - we want to skip this one."""
- 1/0
-
- @dec.skip('Testing the skip decorator')
- def test_deliberately_broken2(self):
- """Another deliberately broken test - we want to skip this one."""
- 1/0
-
- @dec.skip_linux
- def test_linux(self):
- self.assertNotEquals(sys.platform,'linux2',"This test can't run under linux")
-
- @dec.skip_win32
- def test_win32(self):
- self.assertNotEquals(sys.platform,'win32',"This test can't run under windows")
-
- @dec.skip_osx
- def test_osx(self):
- self.assertNotEquals(sys.platform,'darwin',"This test can't run under osx")
View
65 IPython/testing/util.py
@@ -1,65 +0,0 @@
-# encoding: utf-8
-"""This file contains utility classes for performing tests with Deferreds.
-"""
-#-----------------------------------------------------------------------------
-# Copyright (C) 2009 The IPython Development Team
-#
-# Distributed under the terms of the BSD License. The full license is in
-# the file COPYING, distributed as part of this software.
-#-----------------------------------------------------------------------------
-
-#-----------------------------------------------------------------------------
-# Imports
-#-----------------------------------------------------------------------------
-
-from twisted.trial import unittest
-from twisted.internet import defer
-
-#-----------------------------------------------------------------------------
-# Classes and functions
-#-----------------------------------------------------------------------------
-
-class DeferredTestCase(unittest.TestCase):
-
- def assertDeferredEquals(self, deferred, expectedResult,
- chainDeferred=None):
- """Calls assertEquals on the result of the deferred and expectedResult.
-
- chainDeferred can be used to pass in previous Deferred objects that
- have tests being run on them. This chaining of Deferred's in tests
- is needed to insure that all Deferred's are cleaned up at the end of
- a test.
- """
-
- if chainDeferred is None:
- chainDeferred = defer.succeed(None)
-
- def gotResult(actualResult):
- self.assertEquals(actualResult, expectedResult)
-
- deferred.addCallback(gotResult)
-
- return chainDeferred.addCallback(lambda _: deferred)
-
- def assertDeferredRaises(self, deferred, expectedException,
- chainDeferred=None):
- """Calls assertRaises on the Failure of the deferred and expectedException.
-
- chainDeferred can be used to pass in previous Deferred objects that
- have tests being run on them. This chaining of Deferred's in tests
- is needed to insure that all Deferred's are cleaned up at the end of
- a test.
- """
-
- if chainDeferred is None:
- chainDeferred = defer.succeed(None)
-
- def gotFailure(f):
- #f.printTraceback()
- self.assertRaises(expectedException, f.raiseException)
- #return f
-
- deferred.addBoth(gotFailure)
-
- return chainDeferred.addCallback(lambda _: deferred)
-
View
5 setup.py
@@ -223,11 +223,6 @@ def cleanup():
]
}
setup_args['extras_require'] = dict(
- kernel = [
- 'zope.interface>=3.4.1',
- 'Twisted>=8.0.1',
- 'foolscap>=0.2.6'
- ],
doc='Sphinx>=0.3',
test='nose>=0.10.1',
security='pyOpenSSL>=0.6'
View
2  setupbase.py
@@ -123,8 +123,6 @@ def find_packages():
add_package(packages, 'frontend.qt')
add_package(packages, 'frontend.qt.console', tests=True)
add_package(packages, 'frontend.terminal', tests=True)
- add_package(packages, 'kernel', config=False, tests=True, scripts=True)
- add_package(packages, 'kernel.core', config=False, tests=True)
add_package(packages, 'lib', tests=True)
add_package(packages, 'quarantine', tests=True)
add_package(packages, 'scripts')
View
39 setupext/setupext.py
@@ -56,45 +56,6 @@ def check_for_ipython():
print_status("IPython", IPython.__version__)
return True
-def check_for_zopeinterface():
- try:
- import zope.interface
- except ImportError:
- print_status("zope.Interface", "Not found (required for parallel computing capabilities)")
- return False
- else:
- print_status("Zope.Interface","yes")
- return True
-
-def check_for_twisted():
- try:
- import twisted
- except ImportError:
- print_status("Twisted", "Not found (required for parallel computing capabilities)")
- return False
- else:
- major = twisted.version.major
- minor = twisted.version.minor
- micro = twisted.version.micro
- print_status("Twisted", twisted.version.short())
- if not ((major==2 and minor>=5 and micro>=0) or \
- major>=8):
- print_message("WARNING: IPython requires Twisted 2.5.0 or greater, you have version %s"%twisted.version.short())
- print_message("Twisted is required for parallel computing capabilities")
- return False
- else:
- return True
-
-def check_for_foolscap():
- try:
- import foolscap
- except ImportError:
- print_status('Foolscap', "Not found (required for parallel computing capabilities)")
- return False
- else:
- print_status('Foolscap', foolscap.__version__)
- return True
-
def check_for_pyopenssl():
try:
import OpenSSL
Please sign in to comment.
Something went wrong with that request. Please try again.