BVB Source Codes

TextBlob Show run_tests.py Source code

Return Download TextBlob: download run_tests.py Source code - Download TextBlob Source code - Type:.py
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. '''
  5. The main test runner script.
  6.  
  7. Usage: ::
  8.    python run_tests.py
  9. Skip slow tests
  10.    python run_tests.py fast
  11. When there's no Internet
  12.    python run_tests.py no-internet
  13. '''
  14. from __future__ import unicode_literals
  15. import nose
  16. import sys
  17. from textblob.compat import PY2
  18.  
  19. PY26 = PY2 and int(sys.version_info[1]) < 7
  20. PYPY = "PyPy" in sys.version
  21.  
  22.  
  23. def main():
  24.     args = get_argv()
  25.     success = nose.run(argv=args)
  26.     sys.exit(0) if success else sys.exit(1)
  27.  
  28.  
  29. def get_argv():
  30.     args = [sys.argv[0], "tests", '--verbosity', '2']
  31.     attr_conditions = []  # Use nose's attribselect plugin to filter tests
  32.     if "force-all" in sys.argv:
  33.         # Don't exclude any tests
  34.         return args
  35.     if "cover" in sys.argv:
  36.         args += ["--with-coverage", "--cover-html"]
  37.     try:
  38.         __import__('numpy')
  39.     except ImportError:
  40.         # Exclude tests that require numpy
  41.         attr_conditions.append("not requires_numpy")
  42.     if not PY2:
  43.         # Exclude tests that only work on python2
  44.         attr_conditions.append("not py2_only")
  45.     if PYPY:
  46.         # Exclude tests that don't work on PyPY
  47.         attr_conditions.append("not no_pypy")
  48.     if "fast" in sys.argv:
  49.         attr_conditions.append("not slow")
  50.     if "no-internet" in sys.argv:
  51.         # Exclude tests that require internet
  52.         attr_conditions.append("not requires_internet")
  53.  
  54.     # Skip tests with the "skip" attribute
  55.     attr_conditions.append("not skip")
  56.  
  57.     attr_expression = " and ".join(attr_conditions)
  58.     if attr_expression:
  59.         args.extend(["-A", attr_expression])
  60.     return args
  61.  
  62. if __name__ == '__main__':
  63.     main()
  64.  
downloadrun_tests.py Source code - Download TextBlob Source code
Related Source Codes/Software:
monaco-editor - A browser based code editor 2017-01-07
grumpy - Grumpy is a Python to Go source code transcompiler... 2017-01-07
flinux - Foreign LINUX - Run unmodified Linux applications ... 2017-01-07
beeswithmachineguns - A utility for arming (creating) many bees (micro E... 2017-01-07
TopDeepLearning - A list of popular github projects related to deep ... 2017-01-07
yui3 - A library for building richly interactive web appl... 2017-01-07
KineticJS - KineticJS is an HTML5 Canvas JavaScript framework ... 2017-01-07
web-design-standards - Open source UI components and visual style guide f... 2017-01-07
Knuff - The debug application for Apple Push Notification ... 2017-01-07
RoundedImageView - A fast ImageView that supports rounded corners, ov... 2017-01-07
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top