setup.py: add test and test_nogui

This commit is contained in:
André Apitzsch 2017-09-16 00:21:49 +02:00
parent 9ef942469a
commit 9950228dca
2 changed files with 24 additions and 2 deletions

View File

@ -9,7 +9,7 @@ stages:
run-test: run-test:
stage: test stage: test
script: script:
- test/runtests.py -n - python3 setup.py test_nogui
run-pylint: run-pylint:
stage: test stage: test

View File

@ -9,6 +9,7 @@ if sys.version_info[0] < 3:
import codecs import codecs
from setuptools import setup, find_packages from setuptools import setup, find_packages
from setuptools import Command
from setuptools.command.build_py import build_py as _build from setuptools.command.build_py import build_py as _build
from distutils import log from distutils import log
from distutils.util import convert_path, newer from distutils.util import convert_path, newer
@ -137,6 +138,26 @@ class build(_build):
_build.run(self) _build.run(self)
class test(Command):
description = "Run all tests"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
os.system("./test/runtests.py")
class test_nogui(test):
description = "Run tests without GUI"
def run(self):
os.system("./test/runtests.py -n")
package_data_activities = ['data/activities/*/*/*.png'] package_data_activities = ['data/activities/*/*/*.png']
package_data_emoticons = ['data/emoticons/*/emoticons_theme.py', package_data_emoticons = ['data/emoticons/*/emoticons_theme.py',
'data/emoticons/*/*.png', 'data/emoticons/*/*.png',
@ -183,6 +204,8 @@ setup(
], ],
cmdclass = { cmdclass = {
'build_py': build, 'build_py': build,
'test': test,
'test_nogui': test_nogui,
}, },
scripts = [ scripts = [
'scripts/gajim', 'scripts/gajim',
@ -196,5 +219,4 @@ setup(
'nbxmpp', 'nbxmpp',
'pyOpenSSL' 'pyOpenSSL'
], ],
test_suite = 'test'
) )