Add tests class to the seupt.py script

pull/738/head
Nicolargo 2015-11-25 15:28:26 +01:00
parent f315dca729
commit 611cb841fa
1 changed files with 19 additions and 3 deletions

View File

@ -3,13 +3,29 @@
import glob
import sys
from setuptools import setup
from setuptools import setup, Command
if sys.version_info < (2, 6) or (3, 0) <= sys.version_info < (3, 3):
print('Glances requires at least Python 2.6 or 3.3 to run.')
sys.exit(1)
class tests(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import subprocess
import sys
for t in glob.glob('unitest*.py'):
ret = subprocess.call([sys.executable, t]) != 0
if ret != 0:
raise SystemExit(ret)
raise SystemExit(0)
def get_data_files():
data_files = [
@ -21,7 +37,6 @@ def get_data_files():
return data_files
def get_requires():
requires = ['psutil>=2.0.0']
if sys.platform.startswith('win'):
@ -61,6 +76,7 @@ setup(
packages=['glances'],
include_package_data=True,
data_files=get_data_files(),
cmdclass={'test': tests},
test_suite="unitest.py",
entry_points={"console_scripts": ["glances=glances:main"]},
classifiers=[