Deduplicate test cases in suites by taking the longer test case (#53154)
Summary:
Also removes unneeded filename field in S3.
Tested locally:
I locally installed
```
conda install -c anaconda boto3
conda install -c conda-forge unittest-xml-reporting
```
I ran `python test/test_type_hints.py --save-xml=/tmp/reports/test_type_hints` twice to generate two reports of the same test cases.
Then, I edited the print_test_stats.py file to print the report instead of upload to S3, and then ran `CIRCLE_SHA1="$(git rev-parse HEAD)" CIRCLE_JOB=foo python torch/testing/_internal/print_test_stats.py --upload-to-s3 /tmp/reports/test_type_hints`. I verified the report object looked correct:
```
{
'build_pr': '',
'build_tag': '',
'build_sha1': '67cecd7f6cf2956bda1178ae2369cd74ba946f78',
'build_branch': '',
'build_job': 'foo',
'build_workflow_id': '',
'total_seconds': 67.316,
'format_version': 2,
'files': {
'test/test_type_hints': {
'total_seconds': 67.316,
'suites': {
'TestTypeHints': {
'total_seconds': 67.316,
'cases': {
'test_doc_examples': {
'seconds': 8.821,
'status': None
},
'test_run_mypy': {
'seconds': 58.495,
'status': None
}
}
}
}
}
}
}
```
It did take the longer of the two test cases for both test cases.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53154
Reviewed By: samestep
Differential Revision: D26793522
Pulled By: janeyx99
fbshipit-source-id: 5644c1bd38acb8bca0d69851cf1d549a03334b7a