Skip to content

Removing hardcoded filepaths in tests. - #10515

Merged
pllim merged 2 commits into
astropy:masterfrom
i-am-b-soto:remove_hardcoded_filepaths_in_tests
Nov 6, 2020
Merged

pllim merged 2 commits into
astropy:masterfrom
i-am-b-soto:remove_hardcoded_filepaths_in_tests

Conversation

@i-am-b-soto

@i-am-b-soto i-am-b-soto commented Jun 24, 2020 •

Copy link
Copy Markdown
Contributor

Description

This pull request follows #10344 and is attempting to remove hardcoded filepaths in tests in situations where get_pkg_data_filename or get_pkg_data_fileobj can be better used instead.

One problem I'm having right now is withFitsTestCase in /io/fits/tests/init.py
It carries an attribute data_dir that uses a os.path() for the data path. I have removed this attribute in this PR but it's referenced elsewhere. Once on line 733 in /fits/tests/test_hdulist.py, here I believe I've written the correct equivalent without using _data_dir.
And again in
def test_path(self, capsys) in /fits/tests/test_fitsdiff.py , there I haven't figured out a correct equivalent.
Do we think it's beneficial to remove this data_dir attribute?

Overall, this is the work I've done so far, so feel free to tell me if there's something you want added/removed/changed.

Fixes #10344

@pllim

pllim commented Oct 22, 2020

Copy link
Copy Markdown
Member

Hello, given the draft status of this PR and the impending feature freeze tomorrow, I am moving the milestone. Thank you for your understanding.

@pllim pllim modified the milestones: v4.2, v4.3 Oct 22, 2020
@i-am-b-soto

Copy link
Copy Markdown
Contributor Author

Ok

I forgot this PR existed...

@i-am-b-soto
i-am-b-soto force-pushed the remove_hardcoded_filepaths_in_tests branch from da08bf7 to a980805 Compare November 6, 2020 09:09
@i-am-b-soto
i-am-b-soto marked this pull request as ready for review November 6, 2020 09:10
@i-am-b-soto i-am-b-soto changed the title WIP: Removing hardcoded filepaths in tests. Removing hardcoded filepaths in tests. Nov 6, 2020
@i-am-b-soto
i-am-b-soto force-pushed the remove_hardcoded_filepaths_in_tests branch from a980805 to e735d0a Compare November 6, 2020 09:47
@i-am-b-soto

Copy link
Copy Markdown
Contributor Author

Ultimately decided to leave the hardcoded filepath in /io/fits/tests/init.py test_fitsdiff.test_path() depends on it and I'm not confident in re-writing that test.
Think I got the rest though.

@pllim pllim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you! RTD and remote data failures are unrelated.

@pllim
pllim merged commit ab1a1d3 into astropy:master Nov 6, 2020
@i-am-b-soto
i-am-b-soto deleted the remove_hardcoded_filepaths_in_tests branch November 7, 2020 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ideally should avoid hardcoded file path in tests

2 participants