mirror of
https://github.com/beetbox/beets.git
synced 2026-02-20 06:14:22 +01:00
make test suite runnable with "setup.py test"
This commit is contained in:
parent
1ccc3bd6b9
commit
e834ffd44f
3 changed files with 11 additions and 2 deletions
1
setup.py
1
setup.py
|
|
@ -30,6 +30,7 @@ setup(name='beets',
|
|||
license='MIT',
|
||||
platforms='ALL',
|
||||
long_description=_read('README'),
|
||||
test_suite='test.testall.suite',
|
||||
|
||||
packages=[
|
||||
'beets',
|
||||
|
|
|
|||
2
test/__init__.py
Normal file
2
test/__init__.py
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# placeholder
|
||||
|
||||
|
|
@ -17,14 +17,20 @@
|
|||
import unittest
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
pkgpath = os.path.dirname(__file__)
|
||||
sys.path.append(pkgpath)
|
||||
os.chdir(pkgpath)
|
||||
|
||||
def suite():
|
||||
s = unittest.TestSuite()
|
||||
# get the suite() of every module in this directory begining with test_
|
||||
for fname in os.listdir('.'):
|
||||
for fname in os.listdir(pkgpath):
|
||||
match = re.match(r'(test_\S+)\.py$', fname)
|
||||
if match:
|
||||
s.addTest(__import__(match.group(1)).suite())
|
||||
modname = match.group(1)
|
||||
s.addTest(__import__(modname).suite())
|
||||
return s
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
Loading…
Reference in a new issue