Phoenix500526 commented on PR #12354: URL: https://github.com/apache/arrow-rs/pull/12354#issuecomment-7196700291
> > fyi [@alamb](https://github.com/alamb) [@etseidl](https://github.com/etseidl) [@Rich-T-kid](https://github.com/Rich-T-kid) [@sdf-jkl](https://github.com/sdf-jkl) if we're ok with introducing rstest framework for our unit tests; i think its generally fine, maybe there could be concerns about test compilation (since I think it creates each case as a separate test?) but arrow-rs test suite is quite a manageable size so far 🤔 > > I am personally not a fan of rstest as I think it encourages a "shotgun" style of testing (test all the things rather than focused testing). That being said, it ends up used in basically all the projects I work on so I think I am in the minority here and I think it is fine with me > > Thank you for this [@Jefffrey](https://github.com/Jefffrey) and [@Phoenix500526](https://github.com/Phoenix500526) Thanks @alamb and @Jefffrey for reviewing this and sharing your concerns. I agree that focused tests are preferable. rstest is a powerful tool that makes tests easier to write, but that does not automatically make them good tests. With LLMs making it easier to produce large amounts of test code, we still need to be deliberate about what each test verifies. I think rstest can help arrow-rs address three patterns I have encountered while reviewing the existing tests: 1. Very similar tests scattered through a file, often distinguished by names such as test_xxx_i32 and test_xxx_i64. Named cases can bring these together and share the setup and assertions. Maintaining several copies also makes it easier for their behavior to drift unintentionally. 2. Long test functions containing repeated assertions, such as [test_add_months_date](https://github.com/apache/arrow-rs/blob/44a4bdb287dfcc7297c5fb4c98d8c6d8c43f6e70/arrow-array/src/delta.rs#L97-L219). It repeatedly calls the same function with different month offsets and expected dates, covering month-end handling, year boundaries, and overflow. Separating those behaviors where appropriate and expressing the inputs and expectations as named cases would make the coverage easier to review. 3. Deeply nested parameter loops, such as [test_zip_primitive_with_scalar_matches_general_path](https://github.com/apache/arrow-rs/blob/44a4bdb287dfcc7297c5fb4c98d8c6d8c43f6e70/arrow-select/src/zip.rs#L2047-L2116), which has six nested loops. For tests like this, we should consider whether distinct behaviors can be separated into focused tests, then use rstest to express the relevant parameter combinations. This requires care to preserve coverage, particularly when the original loops share a random number generator. Simply replacing the loops with a large Cartesian product would not address the design concern. That improvement in reviewability is why I think introducing rstest is worthwhile. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
