Use run_tests behaviour from silx

- Testing the source project is now the default behaviour (instead of testing the system package)
- --installed was introduced to test the system package
- -i --insource was removed (it is now the default behaviour without args)
This commit is contained in:
Valentin Valls 2018-01-09 15:09:38 +01:00
parent 40d63c33ba
commit 30ddd95a18
6 changed files with 17 additions and 18 deletions

View File

@ -47,4 +47,4 @@ install:
# command to run tests
script:
- "python setup.py test"
- "python ./run_tests.py -m"
- "python ./run_tests.py -m --installed"

View File

@ -88,7 +88,7 @@ build_script:
- "del pyFAI\\ext\\histogram.c"
- "python setup.py build %BUILD_ARGS%"
#- "python setup.py test"
- "python run_tests.py -i -m"
- "python run_tests.py -m"
- "python setup.py bdist_wheel bdist_msi"
- ps: "ls dist"
# Install the generated wheel package to test it
@ -116,7 +116,7 @@ test_script:
# Print Python info
- "python ci\\info_platform.py"
- "pip list"
- "python run_tests.py"
- "python run_tests.py --installed"
# Leave test virtualenv
- "%VENV_TEST_DIR%\\Scripts\\deactivate.bat"

View File

@ -48,7 +48,7 @@ override_dh_install:
# inactive test for now
override_dh_auto_test:
PYBUILD_SYSTEM=custom \
PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} PYFAI_TESTIMAGES=testimages PYFAI_DATA=$(shell pwd) {interpreter} ./run_tests.py" dh_auto_test
PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} PYFAI_TESTIMAGES=testimages PYFAI_DATA=$(shell pwd) {interpreter} ./run_tests.py --installed" dh_auto_test
override_dh_installman:
dh_installman -p pyfai build/man/*.1

View File

@ -34,7 +34,7 @@ override_dh_install:
# inactive test for now
override_dh_auto_test:
PYBUILD_SYSTEM=custom \
PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} PYFAI_TESTIMAGES=testimages PYFAI_DATA=$(shell pwd) {interpreter} ./run_tests.py" dh_auto_test
PYBUILD_TEST_ARGS="PYTHONPATH={build_dir} PYFAI_TESTIMAGES=testimages PYFAI_DATA=$(shell pwd) {interpreter} ./run_tests.py --installed" dh_auto_test
override_dh_installman:
dh_installman -p pyfai build/man/*.1

View File

@ -281,9 +281,10 @@ PYFAI_OPENCL=False to disable OpenCL tests.
parser = ArgumentParser(description='Run the tests.',
epilog=epilog)
parser.add_argument("-i", "--insource",
action="store_true", dest="insource", default=False,
help="Use the build source and not the installed version")
parser.add_argument("--installed",
action="store_true", dest="installed", default=False,
help=("Test the installed version instead of" +
"building from the source"))
parser.add_argument("-c", "--coverage", dest="coverage",
action="store_true", default=False,
help=("Report code coverage" +
@ -361,16 +362,14 @@ if (os.path.dirname(os.path.abspath(__file__)) ==
# import module
if not options.insource:
if options.installed: # Use installed version
try:
module = importer(PROJECT_NAME)
except ImportError:
logger.warning(
"%s missing, using built (i.e. not installed) version",
except:
raise ImportError(
"%s not installed: Cannot run tests on installed version" %
PROJECT_NAME)
options.insource = True
if options.insource:
else: # Use built source
build_dir = build_project(PROJECT_NAME, PROJECT_DIR)
sys.path.insert(0, build_dir)

View File

@ -25,7 +25,7 @@
# ###########################################################################*/
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "30/10/2017"
__date__ = "09/01/2018"
__status__ = "stable"
@ -132,7 +132,7 @@ class build_py(_build_py):
########
class PyTest(Command):
"""Command to start tests running the script: run_tests.py -i"""
"""Command to start tests running the script: run_tests.py"""
user_options = []
def initialize_options(self):
@ -143,7 +143,7 @@ class PyTest(Command):
def run(self):
import subprocess
errno = subprocess.call([sys.executable, 'run_tests.py', '-i'])
errno = subprocess.call([sys.executable, 'run_tests.py'])
if errno != 0:
raise SystemExit(errno)