[contrib] Fix "custom_path" already exist bug#8770
[contrib] Fix "custom_path" already exist bug#8770huanmei9 wants to merge 3 commits intoapache:mainfrom huanmei9:main
Conversation
|
Hi @huanmei9, just curious what the use case is here? Doesn't this allow for race conditions and pollution by re-using temporary directories? |
|
I believe the correct way to do this is |
|
Hmm I agree with @tkonolige. It is slightly better to use the existing API provided by python. Please make changes accordingly and then we get the PR merged :-) Thanks a lot! |
|
Hi @tkonolige @junrushao1994 . |
Modify it according to leandron's suggestion. Co-authored-by: Leandro Nunes <leandro.nunes@arm.com>
|
Hi, @leandron . |
|
Hi @huanmei9, I would suggest that the current implementation of
With the current behaviour, if two tasks attempt to do this in parallel (such as parallel tests from pytest-xdist), you get the following:
With this change, you can instead have:
Therefore, I would suggest that the current implementation of temp dir helps to prevent such concurrency bugs and raises the correct error to ensure we use a new fresh temp directory per invocation - what are your thoughts? |
|
Hi, @Mousius . |
fix error when use custom_path parameter in tempdir funciton.