6 Star 20 Fork 10

Gitee 极速下载/Spyder

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/spyder-ide/spyder
克隆/下载
runtests.py 2.43 KB
一键复制 编辑 原始数据 按行查看 历史
# -*- coding: utf-8 -*-
#
# Copyright © Spyder Project Contributors
# Licensed under the terms of the MIT License
#
"""
Script for running Spyder tests programmatically.
"""
# Standard library imports
import argparse
import os
# To activate/deactivate certain things for pytests only
# NOTE: Please leave this before any other import here!!
os.environ['SPYDER_PYTEST'] = 'True'
# Third party imports
# NOTE: This needs to be imported before any QApplication.
# Don't remove it or change it to a different location!
# pylint: disable=wrong-import-position
from qtpy import QtWebEngineWidgets # noqa
import pytest
# To run our slow tests only in our CIs
CI = bool(os.environ.get('CI', None))
RUN_SLOW = os.environ.get('RUN_SLOW', None) == 'true'
def run_pytest(run_slow=False, extra_args=None):
"""Run pytest tests for Spyder."""
# Be sure to ignore subrepos
pytest_args = ['-vv', '-rw', '--durations=10', '--ignore=./external-deps',
'-W ignore::UserWarning', '--timeout=120',
'--timeout_method=thread']
if CI:
# Show coverage
pytest_args += ['--cov=spyder', '--no-cov-on-fail', '--cov-report=xml']
# To display nice tests resume in Azure's web page
if os.environ.get('AZURE', None) is not None:
pytest_args += ['--cache-clear', '--junitxml=result.xml']
if run_slow or RUN_SLOW:
pytest_args += ['--run-slow']
# Allow user to pass a custom test path to pytest to e.g. run just one test
if extra_args:
pytest_args += extra_args
print("Pytest Arguments: " + str(pytest_args))
errno = pytest.main(pytest_args)
# sys.exit doesn't work here because some things could be running in the
# background (e.g. closing the main window) when this point is reached.
# If that's the case, sys.exit doesn't stop the script as you would expect.
if errno != 0:
raise SystemExit(errno)
def main():
"""Parse args then run the pytest suite for Spyder."""
test_parser = argparse.ArgumentParser(
usage='python runtests.py [-h] [--run-slow] [pytest_args]',
description="Helper script to run Spyder's test suite")
test_parser.add_argument('--run-slow', action='store_true', default=False,
help='Run the slow tests')
test_args, pytest_args = test_parser.parse_known_args()
run_pytest(run_slow=test_args.run_slow, extra_args=pytest_args)
if __name__ == '__main__':
main()
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/mirrors/Spyder.git
git@gitee.com:mirrors/Spyder.git
mirrors
Spyder
Spyder
master

搜索帮助