4a7aaa6ce5
Move shared parts into test.core and use it in LESS, issues and bootstrap3 auto-generated tests. This simplifies the test code and allows to use nosetests (or any other test runner).
35 lines
798 B
Python
35 lines
798 B
Python
"""
|
|
lesscpy test runner.
|
|
"""
|
|
import os
|
|
import re
|
|
import sys
|
|
import unittest
|
|
|
|
|
|
here = os.path.dirname(__file__)
|
|
path = os.path.abspath(here)
|
|
while os.path.dirname(path) != path:
|
|
if os.path.exists(os.path.join(path, 'lesscpy', '__init__.py')):
|
|
sys.path.insert(0, path)
|
|
break
|
|
path = os.path.dirname(path)
|
|
|
|
|
|
def find():
|
|
svn = re.compile('\.svn')
|
|
test = re.compile('test.+\.py$')
|
|
alltests = unittest.TestSuite()
|
|
for path, _, files in os.walk(here):
|
|
if svn.search(path):
|
|
continue
|
|
for f in files:
|
|
if test.search(f):
|
|
module = __import__(f.split('.')[0])
|
|
alltests.addTest(unittest.findTestCases(module))
|
|
return alltests
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main(defaultTest='find')
|