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

Update graph tests to always use tmpfile dir #649

Merged
merged 4 commits into from
Apr 15, 2020
Merged

Conversation

dsherry
Copy link
Contributor

@dsherry dsherry commented Apr 15, 2020

Also clean up files if existence test fails.

Fixes #458

@codecov
Copy link

codecov bot commented Apr 15, 2020

Codecov Report

Merging #649 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #649   +/-   ##
=======================================
  Coverage   98.97%   98.97%           
=======================================
  Files         136      136           
  Lines        4694     4696    +2     
=======================================
+ Hits         4646     4648    +2     
  Misses         48       48           
Impacted Files Coverage Δ
evalml/pipelines/graphs.py 95.83% <100.00%> (ø)
evalml/tests/pipeline_tests/test_graphs.py 100.00% <100.00%> (ø)

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 9353977...e6cbe4d. Read the comment docs.

@dsherry dsherry marked this pull request as ready for review April 15, 2020 14:28
@dsherry dsherry requested a review from jeremyliweishih April 15, 2020 14:28
@@ -36,6 +36,8 @@ def make_pipeline_graph(component_list, graph_name, filepath=None):
f = open(filepath, 'w')
f.close()
except IOError:
if os.path.exists(filepath):
os.remove(filepath)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Codecov is yelling at me about this line... I'll add a mocking unit test!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jeremyliweishih does the logic here make sense to you? Would be good to have a sanity check.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes it does! tmpdir might be redundant with this but doesn't hurt!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually removing tmpr may fix codecov?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I don't think this is necessary, deleting

Copy link
Collaborator

@jeremyliweishih jeremyliweishih left a comment

Choose a reason for hiding this comment

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

Looks good other than codecov!

@dsherry dsherry force-pushed the ds_458_graph_test_fix branch from 054ad8d to 3c07623 Compare April 15, 2020 14:55
except IOError:
raise ValueError(('Specified parent directory does not exist: {}'.format(filepath)))
except (IOError, FileNotFoundError):
raise ValueError(('Specified filepath is not writeable: {}'.format(filepath)))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So here's what I'm thinking. If the open() succeeded, that will have created an empty file, but that's fine because the rest of the code will write to that location. And if the open() failed, there's nothing to clean up, so we don't need to call os.remove(filepath)

@dsherry dsherry force-pushed the ds_458_graph_test_fix branch from 3c07623 to bcbe015 Compare April 15, 2020 15:21
@dsherry dsherry force-pushed the ds_458_graph_test_fix branch from bcbe015 to e6cbe4d Compare April 15, 2020 16:46
@dsherry dsherry merged commit 495702c into master Apr 15, 2020
@dsherry dsherry deleted the ds_458_graph_test_fix branch April 15, 2020 17:05
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.

Use tmpdir for test_graphs.test_invalid_format + test_invalid_path
2 participants