Skip to content

Commit

Permalink
Add human readable names for parameterized tests
Browse files Browse the repository at this point in the history
Summary:
`test_property_type_hints`  is a parameterized test with many test cases. Consider a contrived example when one of those test cases fails. Without human readable names, the relevant portion of the failure looks like

```
Fail: thrift/test/thrift-python:abstract_types_test-cpython3.10 - test_property_type_hints_59 (thrift.test.thrift-python.abstract_types_test.ThriftPythonAbstractTypesTest) (0.0s)
[2024-11-16T23:43:13.580-08:00]
[2024-11-16T23:43:13.580-08:00] test_property_type_hints_59 (thrift.test.thrift-python.abstract_types_test.ThriftPythonAbstractTypesTest) ... FAIL
```

The failed test appears as `test_property_type_hints_59`, which doesn't make it easy for the human who has to debug this problem to find the test case that failed.

With the human readable test name, the same failure looks like
```
Fail: thrift/test/thrift-python:abstract_types_test-cpython3.10 - test_property_type_hints_59_TestStructCopyAbstract_optional_i32 (thrift.test.thrift-python.abstract_types_test.ThriftPythonAbstractTypesTest) (0.0s)
[2024-11-16T23:46:39.974-08:00]
[2024-11-16T23:46:39.974-08:00] test_property_type_hints_59_TestStructCopyAbstract_optional_i32 (thrift.test.thrift-python.abstract_types_test.ThriftPythonAbstractTypesTest) ... FAIL
```

The failed test now appears as `test_property_type_hints_59_TestStructCopyAbstract_optional_i32`. This now allows the human to interpret `TestStructCopyAbstract_optional_i32` as `TestStructCopyAbstract.optional_i32` and search for that string, which makes it easier to find this needle in the haystack.

Reviewed By: yoney

Differential Revision: D65536377

fbshipit-source-id: 52387b729688a5e9d31258c7d9a8b1a19dffaedf
  • Loading branch information
Satish Kumar authored and facebook-github-bot committed Nov 18, 2024
1 parent a11f31f commit 41ea844
Showing 1 changed file with 93 additions and 3 deletions.
Loading

0 comments on commit 41ea844

Please sign in to comment.