Permalink
Browse files

Require nose for run

--HG--
branch : sneakylang
  • Loading branch information...
1 parent 78dff16 commit 15c62631a7b9cfeff7c05f2c66743e2f7227122f almad committed Mar 24, 2009
Showing with 2 additions and 48 deletions.
  1. +2 −48 sneakylang/test/run.py
View
50 sneakylang/test/run.py
@@ -1,52 +1,6 @@
#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-import unittest
-import imp
-import os
-import sys
-
-os.chdir(os.path.dirname(os.path.abspath(__file__)))
-
-def getSuites():
- tests = []
- for i in os.listdir(os.curdir):
- if i.startswith("test_") and i.endswith(".py"):
- tests.append(imp.load_source(i[5:-3], i))
- return tests
-
-def runTests(tests):
- loader = unittest.TestLoader()
- suite = unittest.TestSuite()
- for test in tests:
- testSuite = loader.loadTestsFromModule(test)
- suite.addTests(testSuite)
- unittest.TextTestRunner(verbosity=1, descriptions=1).run(suite)
-
-def main():
- try:
- import nose
- cover = False
- if len(sys.argv) > 1 and sys.argv[1] == "-c":
- import coverage
- coverage.start()
- cover = True
- del sys.argv[1]
- nose.run()
- if cover:
- coverage.stop()
- moduleList = [mod for name, mod in sys.modules.copy().iteritems()
- if getattr(mod, '__file__', None) and
- name.startswith('sneakylang.') and
- 'test' not in name
- ]
- moduleList.sort()
- coverage.report(moduleList)
-
- except ImportError:
- # dirty unittest run
- tests = getSuites()
- runTests(tests)
+import nose
if __name__ == "__main__":
- main()
+ nose.run_exit()

0 comments on commit 15c6263

Please sign in to comment.