Skip to content

Commit

Permalink
feat(tests): add pytest-rerunfailures (#3993)
Browse files Browse the repository at this point in the history
feat(tests): add rerun test when failures
  • Loading branch information
AlejandroSuero authored Sep 12, 2024
1 parent c2045ac commit f48daf1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .config/python/dev/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pytablewriter
pytest-cov
pytest-timeout
pytest-xdist
pytest-rerunfailures
python-gitlab
python-gitlab
python-multipart
Expand Down
1 change: 1 addition & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
"readdir-scoped-modules",
"rechoir",
"repositoryformatversion",
"rerunfailures",
"reusify",
"rimraf",
"rulesetsoverridetype",
Expand Down
12 changes: 6 additions & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ git config --global --add safe.directory /tmp/lint
# Called by Auto-update CI job
if [ "${UPGRADE_LINTERS_VERSION}" == "true" ]; then
echo "[MegaLinter init] UPGRADING LINTER VERSION"
pip install pytest-cov pytest-timeout
pip install pytest-cov pytest-timeout pytest-rerunfailures
# Run only get_linter_version test methods
pytest -v --durations=0 -k _get_linter_version megalinter/
pytest --reruns 3 --reruns-delay 1 -v --durations=0 -k _get_linter_version megalinter/
# Run only get_linter_help test methods
pytest -v --durations=0 -k _get_linter_help megalinter/
pytest --reruns 3 --reruns-delay 1 -v --durations=0 -k _get_linter_help megalinter/
# Reinstall mkdocs-material because of broken dependency
pip3 install --upgrade markdown mike mkdocs-material pymdown-extensions "mkdocs-glightbox==0.3.2" mdx_truly_sane_lists jsonschema json-schema-for-humans giturlparse webpreview github-dependents-info
cd /tmp/lint || exit 1
Expand All @@ -45,11 +45,11 @@ fi
# Run test cases with pytest
if [ "${TEST_CASE_RUN}" == "true" ]; then
echo "[MegaLinter init] RUNNING TEST CASES"
pip install pytest-cov pytest-timeout pytest-xdist
pip install pytest-cov pytest-timeout pytest-xdist pytest-rerunfailures
if [ -z "${TEST_KEYWORDS}" ]; then
pytest -v --timeout=300 --durations=0 --cov=megalinter --cov-report=xml --numprocesses auto --dist loadscope megalinter/
pytest --reruns 3 --reruns-delay 1 -v --timeout=300 --durations=0 --cov=megalinter --cov-report=xml --numprocesses auto --dist loadscope megalinter/
else
pytest -v --timeout=300 --durations=0 --numprocesses auto --dist loadscope -k "${TEST_KEYWORDS}" megalinter/
pytest --reruns 3 --reruns-delay 1 -v --timeout=300 --durations=0 --numprocesses auto --dist loadscope -k "${TEST_KEYWORDS}" megalinter/
fi
PYTEST_STATUS=$?
echo Pytest exited $PYTEST_STATUS
Expand Down

0 comments on commit f48daf1

Please sign in to comment.