/[gentoo-x86]/eclass/python.eclass
Gentoo

Diff of /eclass/python.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.135 Revision 1.136
1# Copyright 1999-2011 Gentoo Foundation 1# Copyright 1999-2011 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.135 2011/10/07 10:52:31 djc Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/python.eclass,v 1.136 2011/10/07 10:53:14 djc Exp $
4 4
5# @ECLASS: python.eclass 5# @ECLASS: python.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Gentoo Python Project <python@gentoo.org> 7# Gentoo Python Project <python@gentoo.org>
8# @BLURB: Eclass for Python packages 8# @BLURB: Eclass for Python packages
2406_python_test_hook() { 2406_python_test_hook() {
2407 if [[ "$#" -ne 1 ]]; then 2407 if [[ "$#" -ne 1 ]]; then
2408 die "${FUNCNAME}() requires 1 argument" 2408 die "${FUNCNAME}() requires 1 argument"
2409 fi 2409 fi
2410 2410
2411 if _python_package_supporting_installation_for_multiple_python_abis && [[ "$(type -t "${FUNCNAME[3]}_$1_hook")" == "function" ]]; then 2411 if _python_package_supporting_installation_for_multiple_python_abis && [[ "$(type -t "${_PYTHON_TEST_FUNCTION}_$1_hook")" == "function" ]]; then
2412 "${FUNCNAME[3]}_$1_hook" 2412 "${_PYTHON_TEST_FUNCTION}_$1_hook"
2413 fi 2413 fi
2414} 2414}
2415 2415
2416# @FUNCTION: python_execute_nosetests 2416# @FUNCTION: python_execute_nosetests
2417# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments] 2417# @USAGE: [-P|--PYTHONPATH PYTHONPATH] [-s|--separate-build-dirs] [--] [arguments]
2451 python_test_function() { 2451 python_test_function() {
2452 local evaluated_PYTHONPATH 2452 local evaluated_PYTHONPATH
2453 2453
2454 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\"" 2454 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
2455 2455
2456 _python_test_hook pre 2456 _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook pre
2457 2457
2458 if [[ -n "${evaluated_PYTHONPATH}" ]]; then 2458 if [[ -n "${evaluated_PYTHONPATH}" ]]; then
2459 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL} 2459 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}
2460 PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?" 2460 PYTHONPATH="${evaluated_PYTHONPATH}" nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"
2461 else 2461 else
2462 echo ${_BOLD}nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL} 2462 echo ${_BOLD}nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@"${_NORMAL}
2463 nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?" 2463 nosetests --verbosity="${PYTHON_TEST_VERBOSITY}" "$@" || return "$?"
2464 fi 2464 fi
2465 2465
2466 _python_test_hook post 2466 _PYTHON_TEST_FUNCTION="python_execute_nosetests" _python_test_hook post
2467 } 2467 }
2468 if _python_package_supporting_installation_for_multiple_python_abis; then 2468 if _python_package_supporting_installation_for_multiple_python_abis; then
2469 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" 2469 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
2470 else 2470 else
2471 if [[ -n "${separate_build_dirs}" ]]; then 2471 if [[ -n "${separate_build_dirs}" ]]; then
2515 python_test_function() { 2515 python_test_function() {
2516 local evaluated_PYTHONPATH 2516 local evaluated_PYTHONPATH
2517 2517
2518 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\"" 2518 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
2519 2519
2520 _python_test_hook pre 2520 _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook pre
2521 2521
2522 if [[ -n "${evaluated_PYTHONPATH}" ]]; then 2522 if [[ -n "${evaluated_PYTHONPATH}" ]]; then
2523 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@"${_NORMAL} 2523 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@"${_NORMAL}
2524 PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@" || return "$?" 2524 PYTHONPATH="${evaluated_PYTHONPATH}" py.test $([[ "${PYTHON_TEST_VERBOSITY}" -ge 2 ]] && echo -v) "$@" || return "$?"
2525 else 2525 else
2526 echo ${_BOLD}py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@"${_NORMAL} 2526 echo ${_BOLD}py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@"${_NORMAL}
2527 py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@" || return "$?" 2527 py.test $([[ "${PYTHON_TEST_VERBOSITY}" -gt 1 ]] && echo -v) "$@" || return "$?"
2528 fi 2528 fi
2529 2529
2530 _python_test_hook post 2530 _PYTHON_TEST_FUNCTION="python_execute_py.test" _python_test_hook post
2531 } 2531 }
2532 if _python_package_supporting_installation_for_multiple_python_abis; then 2532 if _python_package_supporting_installation_for_multiple_python_abis; then
2533 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" 2533 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
2534 else 2534 else
2535 if [[ -n "${separate_build_dirs}" ]]; then 2535 if [[ -n "${separate_build_dirs}" ]]; then
2579 python_test_function() { 2579 python_test_function() {
2580 local evaluated_PYTHONPATH 2580 local evaluated_PYTHONPATH
2581 2581
2582 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\"" 2582 eval "evaluated_PYTHONPATH=\"${PYTHONPATH_template}\""
2583 2583
2584 _python_test_hook pre 2584 _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook pre
2585 2585
2586 if [[ -n "${evaluated_PYTHONPATH}" ]]; then 2586 if [[ -n "${evaluated_PYTHONPATH}" ]]; then
2587 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL} 2587 echo ${_BOLD}PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}
2588 PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?" 2588 PYTHONPATH="${evaluated_PYTHONPATH}" trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"
2589 else 2589 else
2590 echo ${_BOLD}trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL} 2590 echo ${_BOLD}trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@"${_NORMAL}
2591 trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?" 2591 trial $([[ "${PYTHON_TEST_VERBOSITY}" -ge 4 ]] && echo --spew) "$@" || return "$?"
2592 fi 2592 fi
2593 2593
2594 _python_test_hook post 2594 _PYTHON_TEST_FUNCTION="python_execute_trial" _python_test_hook post
2595 } 2595 }
2596 if _python_package_supporting_installation_for_multiple_python_abis; then 2596 if _python_package_supporting_installation_for_multiple_python_abis; then
2597 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@" 2597 python_execute_function ${separate_build_dirs:+-s} python_test_function "$@"
2598 else 2598 else
2599 if [[ -n "${separate_build_dirs}" ]]; then 2599 if [[ -n "${separate_build_dirs}" ]]; then

Legend:
Removed from v.1.135  
changed lines
  Added in v.1.136

  ViewVC Help
Powered by ViewVC 1.1.20