Skip to content

Use temp directory for os test #849

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

Merged
merged 7 commits into from
Apr 19, 2019
Merged

Conversation

palaviv
Copy link
Contributor

@palaviv palaviv commented Apr 19, 2019

This should allow us to extend filesystem tests.

@codecov-io
Copy link

codecov-io commented Apr 19, 2019

Codecov Report

Merging #849 into master will increase coverage by 0.09%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #849      +/-   ##
==========================================
+ Coverage   62.89%   62.99%   +0.09%     
==========================================
  Files          88       88              
  Lines       14547    14547              
  Branches     3288     3288              
==========================================
+ Hits         9150     9164      +14     
+ Misses       3238     3222      -16     
- Partials     2159     2161       +2
Impacted Files Coverage Δ
vm/src/stdlib/os.rs 60.48% <0%> (ø) ⬆️
vm/src/stdlib/time_module.rs 53.84% <0%> (+53.84%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 19be5c9...d704a0f. Read the comment docs.

@palaviv palaviv closed this Apr 19, 2019
@palaviv palaviv reopened this Apr 19, 2019
Copy link
Member

@coolreader18 coolreader18 left a comment

Choose a reason for hiding this comment

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

LGTM, I'll merge once CI is passing. Also, :) חג שמח

base_folder = os.environ["TEMP"]
else:
base_folder = "/tmp"
name = base_folder + os.sep + "test_os"
Copy link
Member

Choose a reason for hiding this comment

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

Could we prefix "test_os" so that if the test failed and someone's cleaning out their temp folder, they could know what it was for? Maybe "rustpython_test_os"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

for f in os.listdir(self.name):
# Currently don't support dir delete.
os.remove(self.name + os.sep + f)
os.rmdir(self.name)
Copy link
Member

Choose a reason for hiding this comment

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

It looks like this is what's causing CI to fail, I think this SO answer has a good solution for it with what modules we have right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed it to not delete the folder. This fails only on rustpython and not in Cpython so I will try to solve this at a later stage. The test folder is in temp and very small so that should not be a problem.

@palaviv
Copy link
Contributor Author

palaviv commented Apr 19, 2019

Great. חג שמח 😃

@coolreader18 coolreader18 merged commit 148ef5c into RustPython:master Apr 19, 2019
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.

3 participants