Switch to setuptools and use pytest

This commit is contained in:
Markus Frosch 2020-05-01 16:43:20 +02:00
parent e4cd22b7bd
commit 8ae32539fe
6 changed files with 19 additions and 38 deletions

View File

@ -33,9 +33,10 @@ jobs:
run: | run: |
python -m pip install --upgrade pip python -m pip install --upgrade pip
pip install -e . pip install -e .
python setup.py develop
- name: Compile all scripts - name: Compile all scripts
run: python -m compileall -f terminatorlib/ tests/ remotinator terminator run: python -m compileall -f terminatorlib/ tests/ remotinator terminator
- name: Run legacy tests - name: Run tests
run: bash run_tests run: python setup.py test

1
.gitignore vendored
View File

@ -10,6 +10,7 @@
/.bzr /.bzr
## Python ## Python
/.eggs
*.pyc *.pyc
*.egg-info *.egg-info
/build /build

View File

@ -1,4 +1,4 @@
include AUTHORS CHANGELOG* COPYING INSTALL README* remotinator setup.py terminator run_tests include AUTHORS CHANGELOG* COPYING INSTALL README* remotinator setup.py terminator
recursive-include data * recursive-include data *
recursive-include doc * recursive-include doc *
recursive-include po * recursive-include po *

View File

@ -1,14 +0,0 @@
#!/bin/bash
for t in tests/test*; do
echo $t
file_type=$(file -b $t)
case ${file_type} in
*[Pp]ython*) python ${t} || exit 1 ;;
*Bourne*) bash ${t} || exit 1 ;;
*bash*) bash ${t} || exit 1 ;;
*perl*) perl ${t} || exit 1 ;;
*) echo "Unknown" ;;
esac
echo
done

2
setup.cfg Normal file
View File

@ -0,0 +1,2 @@
[aliases]
test=pytest

View File

@ -1,13 +1,13 @@
#!/usr/bin/env python #!/usr/bin/env python
from distutils.core import setup from setuptools import setup, Distribution, Command
from distutils.dist import Distribution
from distutils.cmd import Command
from distutils.command.install_data import install_data from distutils.command.install_data import install_data
from distutils.command.build import build from distutils.command.build import build
from distutils.dep_util import newer from distutils.dep_util import newer
from distutils.log import warn, info, error from distutils.log import warn, info, error
from distutils.errors import DistutilsFileError from distutils.errors import DistutilsFileError
import glob import glob
import os import os
import sys import sys
@ -20,6 +20,7 @@ PO_DIR = 'po'
MO_DIR = os.path.join('build', 'mo') MO_DIR = os.path.join('build', 'mo')
CSS_DIR = os.path.join('terminatorlib', 'themes') CSS_DIR = os.path.join('terminatorlib', 'themes')
class TerminatorDist(Distribution): class TerminatorDist(Distribution):
global_options = Distribution.global_options + [ global_options = Distribution.global_options + [
("build-documentation", None, "Build the documentation"), ("build-documentation", None, "Build the documentation"),
@ -177,21 +178,6 @@ class InstallData(install_data):
return data_files return data_files
class Test(Command):
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
import subprocess
import sys
errno = subprocess.call(['bash', 'run_tests'])
raise SystemExit(errno)
if platform.system() in ['FreeBSD', 'OpenBSD']: if platform.system() in ['FreeBSD', 'OpenBSD']:
man_dir = 'man' man_dir = 'man'
else: else:
@ -232,6 +218,9 @@ setup(name=APP_NAME,
'terminatorlib', 'terminatorlib',
'terminatorlib.plugins', 'terminatorlib.plugins',
], ],
setup_requires=[
'pytest-runner',
],
install_requires=[ install_requires=[
'pycairo', 'pycairo',
'configobj', 'configobj',
@ -239,8 +228,10 @@ setup(name=APP_NAME,
'pygobject', 'pygobject',
'psutil', 'psutil',
], ],
tests_require=[
'pytest',
],
package_data={'terminatorlib': ['preferences.glade', 'layoutlauncher.glade']}, package_data={'terminatorlib': ['preferences.glade', 'layoutlauncher.glade']},
cmdclass={'build': BuildData, 'install_data': InstallData, 'uninstall': Uninstall, 'test':Test}, cmdclass={'build': BuildData, 'install_data': InstallData, 'uninstall': Uninstall},
distclass=TerminatorDist distclass=TerminatorDist)
)