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: |
python -m pip install --upgrade pip
pip install -e .
python setup.py develop
- name: Compile all scripts
run: python -m compileall -f terminatorlib/ tests/ remotinator terminator
- name: Run legacy tests
run: bash run_tests
- name: Run tests
run: python setup.py test

1
.gitignore vendored
View File

@ -10,6 +10,7 @@
/.bzr
## Python
/.eggs
*.pyc
*.egg-info
/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 doc *
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
from distutils.core import setup
from distutils.dist import Distribution
from distutils.cmd import Command
from setuptools import setup, Distribution, Command
from distutils.command.install_data import install_data
from distutils.command.build import build
from distutils.dep_util import newer
from distutils.log import warn, info, error
from distutils.errors import DistutilsFileError
import glob
import os
import sys
@ -20,6 +20,7 @@ PO_DIR = 'po'
MO_DIR = os.path.join('build', 'mo')
CSS_DIR = os.path.join('terminatorlib', 'themes')
class TerminatorDist(Distribution):
global_options = Distribution.global_options + [
("build-documentation", None, "Build the documentation"),
@ -177,21 +178,6 @@ class InstallData(install_data):
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']:
man_dir = 'man'
else:
@ -232,6 +218,9 @@ setup(name=APP_NAME,
'terminatorlib',
'terminatorlib.plugins',
],
setup_requires=[
'pytest-runner',
],
install_requires=[
'pycairo',
'configobj',
@ -239,8 +228,10 @@ setup(name=APP_NAME,
'pygobject',
'psutil',
],
tests_require=[
'pytest',
],
package_data={'terminatorlib': ['preferences.glade', 'layoutlauncher.glade']},
cmdclass={'build': BuildData, 'install_data': InstallData, 'uninstall': Uninstall, 'test':Test},
distclass=TerminatorDist
)
cmdclass={'build': BuildData, 'install_data': InstallData, 'uninstall': Uninstall},
distclass=TerminatorDist)