Skip to content

Commit c79debf

Browse files
author
BryanSchroeder
committed
attempting to allow for failed tests to be rerun to see if the cache being cleared allows the failed integrations to pass
1 parent 5342573 commit c79debf

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"lint": "run-s private::lint.* --continue-on-error",
4242
"setup-tests.py": "run-s private::test.py.deploy-*",
4343
"setup-tests.R": "run-s private::test.R.deploy-*",
44-
"citest.integration": "run-s setup-tests.py private::test.integration-*",
44+
"citest.integration": "run-s setup-tests.py private::test.integration-* && python rerun_failed_tests.py",
4545
"citest.unit": "run-s private::test.unit-**",
4646
"test": "pytest && cd dash/dash-renderer && npm run test",
4747
"first-build": "cd dash/dash-renderer && npm i && cd ../../ && cd components/dash-html-components && npm i && npm run extract && cd ../../ && npm run build"

rerun_failed_tests.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import xml.etree.ElementTree as ET
2+
import subprocess
3+
4+
def parse_test_results(file_path):
5+
tree = ET.parse(file_path)
6+
root = tree.getroot()
7+
failed_tests = []
8+
for testcase in root.iter('testcase'):
9+
if testcase.find('failure') is not None:
10+
failed_tests.append(testcase.get('name'))
11+
return failed_tests
12+
13+
def rerun_failed_tests(failed_tests):
14+
if failed_tests:
15+
print("Initial failed tests:", failed_tests)
16+
failed_test_names = ' '.join(failed_tests)
17+
result = subprocess.run(f'pytest --headless {failed_test_names}', shell=True, capture_output=True, text=True)
18+
print(result.stdout)
19+
print(result.stderr)
20+
else:
21+
print('All tests passed.')
22+
23+
if __name__ == "__main__":
24+
failed_tests = parse_test_results('test-reports/junit_intg.xml')
25+
rerun_failed_tests(failed_tests)

0 commit comments

Comments
 (0)