Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tempfile and tempdir should fail test when deletion fails #2351

Closed
Tracked by #2226
Marcono1234 opened this issue Jul 11, 2021 · 1 comment
Closed
Tracked by #2226

tempfile and tempdir should fail test when deletion fails #2351

Marcono1234 opened this issue Jul 11, 2021 · 1 comment
Assignees
Labels
enhancement ✨ Suggestions for adding new features or improving existing ones. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Milestone

Comments

@Marcono1234
Copy link
Contributor

Please describe the feature you'd like to see including any solutions in mind if you have any
Currently tempfile and tempdir use the java.io.File methods which merely return a boolean, and kotest does not check the result whether the file or directory was actually deleted.

Expected
Kotest should (by default?) detect when a temporary file or directory could not be deleted and cause a test failure with a descriptive message stating which files could not be deleted (ideally also first attempting to delete all and accumulating exceptions).

This allows test authors to detect when the tested application does not properly close resources, and avoids temporary files from accumulating.

Ideally this would use java.nio.file.Files methods to give more insight to the user why deletion failed.

For reference, JUnit 5 causes a test failure when deletion fails, see TempDirectory.java.

@Marcono1234 Marcono1234 added the enhancement ✨ Suggestions for adding new features or improving existing ones. label Jul 11, 2021
@sksamuel
Copy link
Member

sksamuel commented Aug 1, 2021

Good suggestion. Added to master will be included in the 5.0 release.

@sksamuel sksamuel closed this as completed Aug 1, 2021
@sksamuel sksamuel added the framework 🏗️ Pertains to the core structure and components of the Kotest framework. label Aug 1, 2021
@sksamuel sksamuel self-assigned this Aug 1, 2021
@sksamuel sksamuel added this to the 5.0 milestone Aug 1, 2021
@sksamuel sksamuel mentioned this issue Aug 1, 2021
71 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ Suggestions for adding new features or improving existing ones. framework 🏗️ Pertains to the core structure and components of the Kotest framework.
Projects
None yet
Development

No branches or pull requests

2 participants