Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
As it was two separate unit tests created/used the same named file in the temp directory. Running separately things are fine and are most often in CI - but CI runs tests in parallel and this has led to occasional failures for example in this log with the relevant excerpt as below
Details and comments
This changes from specific named temp file to creating a temp folder with that named file in it, same as is done in another similar test here
qiskit-machine-learning/test/algorithms/regressors/test_neural_network_regressor.py
Line 187 in a0ea90a
This change should should eliminate that occasional random CI failures where the two tests are run at the same time and there was collision in the file used. By using a temp folder each test will have their own folder and any collision avoided from use of the same named file since they will be in different folders. This also allows multiple instances of the same test to be run in parallel, not that CI does this, but its a more general fix.