Test wheel packages installation and run unit tests.
(pythons)
| 642 | |
| 643 | |
| 644 | def test_wheel_packages(pythons): |
| 645 | """Test wheel packages installation and run unit tests.""" |
| 646 | uninstall_cefpython3_packages(pythons) |
| 647 | for python in pythons: |
| 648 | print("[build_distrib.py] Test wheel package (install, unittests) for" |
| 649 | " {python_name}".format(python_name=python["name"])) |
| 650 | platform_tag = get_pypi_postfix2_for_arch(python["arch"]) |
| 651 | whl_pattern = (r"*{platform_tag}.whl" |
| 652 | .format(platform_tag=platform_tag)) |
| 653 | wheels = glob.glob(os.path.join(DISTRIB_DIR, whl_pattern)) |
| 654 | assert len(wheels) == 1, ("No wheels found in distrib dir for %s" |
| 655 | % python["arch"]) |
| 656 | |
| 657 | # Install wheel |
| 658 | command = ("\"{python}\" -m pip install {wheel}" |
| 659 | .format(python=python["executable"], |
| 660 | wheel=os.path.basename(wheels[0]))) |
| 661 | command = sudo_command(command, python=python["executable"]) |
| 662 | pcode = subprocess.call(command, cwd=DISTRIB_DIR, shell=True) |
| 663 | if pcode != 0: |
| 664 | print("[build_distrib.py] Wheel package installation failed for" |
| 665 | " {python_name}".format(python_name=python["name"])) |
| 666 | sys.exit(1) |
| 667 | |
| 668 | # Run unittests using the installed wheel package |
| 669 | command = ("\"{python}\" {unittests}" |
| 670 | .format(python=python["executable"], |
| 671 | unittests=os.path.join(UNITTESTS_DIR, |
| 672 | "_test_runner.py"))) |
| 673 | pcode = subprocess.call(command, cwd=DISTRIB_DIR, shell=True) |
| 674 | if pcode != 0: |
| 675 | print("[build_distrib.py] ERROR: Unit tests failed for" |
| 676 | " {python_name}".format(python_name=python["name"])) |
| 677 | sys.exit(1) |
| 678 | |
| 679 | |
| 680 | def show_summary(pythons_32bit, pythons_64bit): |
no test coverage detected