Exclude tools and events from python2 tests and packaging

Those two parts require python3.
To avoid duplicating the exclude list, run tests and pylint on a copy
installed via setuptools.
This commit is contained in:
Marek Marczykowski-Górecki 2017-04-14 13:26:45 +02:00
parent d0e8c0515e
commit 7bafd631d4
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
6 changed files with 19 additions and 11 deletions

View File

@ -9,8 +9,9 @@ install:
- pip install --quiet -r ci/requirements.txt - pip install --quiet -r ci/requirements.txt
- git clone https://github.com/"${TRAVIS_REPO_SLUG%%/*}"/qubes-builder ~/qubes-builder - git clone https://github.com/"${TRAVIS_REPO_SLUG%%/*}"/qubes-builder ~/qubes-builder
script: script:
- test -z "$TESTS_ONLY" || PYTHONPATH=test-packages pylint --rcfile=ci/pylintrc qubesmgmt - test -z "$TESTS_ONLY" || python setup.py build
- test -z "$TESTS_ONLY" || ./run-tests - test -z "$TESTS_ONLY" || { cd build/lib; PYTHONPATH=../../test-packages pylint --rcfile=../../ci/pylintrc qubesmgmt; }
- test -z "$TESTS_ONLY" || { cd build/lib; ROOTDIR=../.. ../../run-tests; }
- test -n "$TESTS_ONLY" || ~/qubes-builder/scripts/travis-build - test -n "$TESTS_ONLY" || ~/qubes-builder/scripts/travis-build
env: env:
- TESTS_ONLY=1 - TESTS_ONLY=1

View File

@ -9,4 +9,4 @@ build:
.PHONY: install .PHONY: install
install: install:
$(PYTHON) setup.py install -O1 --skip-build $(PYTHON_PREFIX_ARG) --root $(DESTDIR) $(PYTHON) setup.py install -O1 $(PYTHON_PREFIX_ARG) --root $(DESTDIR)

View File

@ -73,4 +73,4 @@ class QubesTestCase(unittest.TestCase):
def assertAllCalled(self): def assertAllCalled(self):
self.assertEqual( self.assertEqual(
set(self.app.expected_calls.keys()), set(self.app.expected_calls.keys()),
set(self.app.actual_calls)) set(self.app.actual_calls))

View File

@ -40,12 +40,11 @@ Python3 module qubesmgmt.
%build %build
make %{?_smp_mflags} PYTHON=%{__python2}
make %{?_smp_mflags} PYTHON=%{__python3}
%install %install
rm -rf build
%make_install PYTHON=%{__python2} %make_install PYTHON=%{__python2}
rm -rf build
%make_install PYTHON=%{__python3} %make_install PYTHON=%{__python3}

View File

@ -1,10 +1,13 @@
#!/bin/sh #!/bin/sh
: "${PYTHON:=python}" : "${PYTHON:=python}"
: "${TESTPYTHONPATH:=test-packages}" : "${ROOTDIR:=.}"
: "${TESTPYTHONPATH:=$ROOTDIR/test-packages}"
PYTHONPATH="${TESTPYTHONPATH}:${PYTHONPATH}" PYTHONPATH="${TESTPYTHONPATH}:${PYTHONPATH}"
export PYTHONPATH export PYTHONPATH
"${PYTHON}" setup.py egg_info --egg-base "${TESTPYTHONPATH}" [ -r version ] || ln -s ${ROOTDIR}/version ./
"${PYTHON}" -m coverage run --rcfile=ci/coveragerc -m unittest discover -p '*.py' -v "$@" [ -r setup.py ] || ln -s ${ROOTDIR}/setup.py ./
"${PYTHON}" ./setup.py egg_info --egg-base "${TESTPYTHONPATH}"
"${PYTHON}" -m coverage run --rcfile=$ROOTDIR/ci/coveragerc -m unittest discover -s qubesmgmt/tests -p '*.py' -v "$@"

View File

@ -1,6 +1,11 @@
# vim: fileencoding=utf-8 # vim: fileencoding=utf-8
import setuptools import setuptools
import sys
exclude=[]
if sys.version_info[0:2] < (3, 5):
exclude = ['qubesmgmt.events', 'qubesmgmt.tools', 'qubesmgmt.tests.tools']
if __name__ == '__main__': if __name__ == '__main__':
setuptools.setup( setuptools.setup(
@ -11,7 +16,7 @@ if __name__ == '__main__':
description='Qubes mgmt API package', description='Qubes mgmt API package',
license='LGPL2.1+', license='LGPL2.1+',
url='https://www.qubes-os.org/', url='https://www.qubes-os.org/',
packages=setuptools.find_packages(), packages=setuptools.find_packages(exclude=exclude),
entry_points={ entry_points={
'qubesmgmt.vm': [ 'qubesmgmt.vm': [
'AppVM = qubesmgmt.vm:AppVM', 'AppVM = qubesmgmt.vm:AppVM',