MCPcopy Create free account
hub / github.com/ipython/ipython / run_iptest

Function run_iptest

IPython/testing/iptest.py:377–457  ·  view source on GitHub ↗

Run the IPython test suite using nose. This function is called when this script is **not** called with the form `iptest all`. It simply calls nose with appropriate command line flags and accepts all of the standard nose arguments.

()

Source from the content-addressed store, hash-verified

375
376
377def run_iptest():
378 """Run the IPython test suite using nose.
379
380 This function is called when this script is **not** called with the form
381 `iptest all`. It simply calls nose with appropriate command line flags
382 and accepts all of the standard nose arguments.
383 """
384 # Apply our monkeypatch to Xunit
385 if '--with-xunit' in sys.argv and not hasattr(Xunit, 'orig_addError'):
386 monkeypatch_xunit()
387
388 arg1 = sys.argv[1]
389 if arg1.startswith('IPython/'):
390 if arg1.endswith('.py'):
391 arg1 = arg1[:-3]
392 sys.argv[1] = arg1.replace('/', '.')
393
394 arg1 = sys.argv[1]
395 if arg1 in test_sections:
396 section = test_sections[arg1]
397 sys.argv[1:2] = section.includes
398 elif arg1.startswith('IPython.') and arg1[8:] in test_sections:
399 section = test_sections[arg1[8:]]
400 sys.argv[1:2] = section.includes
401 else:
402 section = TestSection(arg1, includes=[arg1])
403
404
405 argv = sys.argv + [ '--detailed-errors', # extra info in tracebacks
406 # We add --exe because of setuptools' imbecility (it
407 # blindly does chmod +x on ALL files). Nose does the
408 # right thing and it tries to avoid executables,
409 # setuptools unfortunately forces our hand here. This
410 # has been discussed on the distutils list and the
411 # setuptools devs refuse to fix this problem!
412 '--exe',
413 ]
414 if '-a' not in argv and '-A' not in argv:
415 argv = argv + ['-a', '!crash']
416
417 if nose.__version__ >= '0.11':
418 # I don't fully understand why we need this one, but depending on what
419 # directory the test suite is run from, if we don't give it, 0 tests
420 # get run. Specifically, if the test suite is run from the source dir
421 # with an argument (like 'iptest.py IPython.core', 0 tests are run,
422 # even if the same call done in this directory works fine). It appears
423 # that if the requested package is in the current dir, nose bails early
424 # by default. Since it's otherwise harmless, leave it in by default
425 # for nose >= 0.11, though unfortunately nose 0.10 doesn't support it.
426 argv.append('--traverse-namespace')
427
428 plugins = [ ExclusionPlugin(section.excludes), KnownFailure(),
429 SubprocessStreamCapturePlugin() ]
430
431 # we still have some vestigial doctests in core
432 if (section.name.startswith(('core', 'IPython.core', 'IPython.utils'))):
433 plugins.append(IPythonDoctest())
434 argv.extend([

Callers 1

iptest.pyFile · 0.85

Calls 6

KnownFailureClass · 0.90
IPythonDoctestClass · 0.90
monkeypatch_xunitFunction · 0.85
TestSectionClass · 0.85
ExclusionPluginClass · 0.85

Tested by

no test coverage detected