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

Files are created in tmp dirs and they are cleaned if tests succeed (#1061) #1570

Merged
merged 3 commits into from
Apr 12, 2024

Conversation

GMDSantana
Copy link
Contributor

As discussed in #1061, here we use this:

https://docs.python.org/3/library/tempfile.html#tempfile.TemporaryDirectory

to handle the creation of temporary directories. The files are not deleted in case there are any test failures, so they can be inspected.

@GMDSantana GMDSantana marked this pull request as ready for review April 12, 2024 05:06
@progval
Copy link
Owner

progval commented Apr 12, 2024

Thanks

Could you create a single temporary directory with the three test- inside it, as well as print its path? This will make it easier for people running tests to locate where the data is.

if not os.path.exists('test-conf'):
os.mkdir('test-conf')
main_temp_dir = TemporaryDirectory()
print(f"Temporary directory path: {main_temp_dir.name}")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to the .detach() case so it's printed at the end (more visible), and only if the directory is kept.

@GMDSantana GMDSantana requested a review from progval April 12, 2024 08:32
@progval
Copy link
Owner

progval commented Apr 12, 2024

Thanks!

@progval progval merged commit 03a3777 into progval:testing Apr 12, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants