sqla_nose.py 806 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python
  2. """
  3. nose runner script.
  4. This script is a front-end to "nosetests" which
  5. installs SQLAlchemy's testing plugin into the local environment.
  6. """
  7. import sys
  8. import nose
  9. import os
  10. if not sys.flags.no_user_site:
  11. sys.path.insert(
  12. 0,
  13. os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')
  14. )
  15. # use bootstrapping so that test plugins are loaded
  16. # without touching the main library before coverage starts
  17. bootstrap_file = os.path.join(
  18. os.path.dirname(__file__), "lib", "sqlalchemy",
  19. "testing", "plugin", "bootstrap.py"
  20. )
  21. with open(bootstrap_file) as f:
  22. code = compile(f.read(), "bootstrap.py", 'exec')
  23. to_bootstrap = "nose"
  24. exec(code, globals(), locals())
  25. from noseplugin import NoseSQLAlchemy
  26. nose.main(addplugins=[NoseSQLAlchemy()])