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

BLD: Install scripts tests only during inplace #22413

Merged
merged 1 commit into from
Aug 21, 2018

Conversation

gfyoung
Copy link
Member

@gfyoung gfyoung commented Aug 19, 2018

The scripts directory is not visible if the installation is not inplace.

Follow-up to #20061.

cc @WillAyd @datapythonista

@gfyoung gfyoung added Bug Build Library building on various platforms labels Aug 19, 2018
@gfyoung gfyoung added this to the 0.24.0 milestone Aug 19, 2018
@WillAyd
Copy link
Member

WillAyd commented Aug 19, 2018

Would the other option be to just skip these tests if the scripts folder isn't included? I actually wonder if that would be preferable especially in cases where users install a binary and try to run pd.test() in the REPL

@gfyoung
Copy link
Member Author

gfyoung commented Aug 19, 2018

@WillAyd : I don't see why we should be packaging these tests when we do a release of pandas to the general public (the scripts directory won't be present at all). That's another reason why I would prefer exclusion vs. just skipping tests.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

shouldn’t you just put a skip in the tests themselves?

@gfyoung
Copy link
Member Author

gfyoung commented Aug 19, 2018

@jreback : See my answer above. The only time these tests should be running is if we do an inplace install, since that's when the scripts directory will be visible. Otherwise, why should we be packaging those tests at all in the distribution (e.g. the public releases)?

@codecov
Copy link

codecov bot commented Aug 19, 2018

Codecov Report

Merging #22413 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22413   +/-   ##
=======================================
  Coverage   92.05%   92.05%           
=======================================
  Files         169      169           
  Lines       50733    50733           
=======================================
  Hits        46702    46702           
  Misses       4031     4031
Flag Coverage Δ
#multiple 90.46% <ø> (ø) ⬆️
#single 42.24% <ø> (ø) ⬆️

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 4f11d1a...c14c540. Read the comment docs.

@jorisvandenbossche
Copy link
Member

Would the other option be to just skip these tests if the scripts folder isn't included?

+1

@jorisvandenbossche
Copy link
Member

@gfyoung I understand your argument, but I think the added complexity (I would expect to find logic about whether the tests are ran/skipped in the tests itself, our setup.py is already very complex) is not worth the few kb's for those tests.

@jreback
Copy link
Contributor

jreback commented Aug 20, 2018

agree with @jorisvandenbossche here, pls simply skip these test. We don't want multiple paths for doing things like skips.

@gfyoung
Copy link
Member Author

gfyoung commented Aug 20, 2018

Fair enough. IMHO, these validation tests should not have been located in the pandas/tests directory, but oh well. 🤷‍♂️

@datapythonista
Copy link
Member

Not sure what it involves in the CI configuration, but I'm +1 on moving the tests for the scripts to scripts/tests too.

@gfyoung
Copy link
Member Author

gfyoung commented Aug 20, 2018

@jreback @jorisvandenbossche : Thoughts on moving the tests? As much as I know both of you don't want the extra complexity in setup.py of "skipping" the copying of certain files during distribution, I am also not a fan of seeing tests fail locally just because the scripts isn't packaged.

We can skip the tests for now, but the long-term solution I think is just moving them elsewhere.

@jorisvandenbossche
Copy link
Member

I am also not a fan of seeing tests fail locally just because the scripts isn't packaged.

They wouldn't fail, the idea is that they would be skipped.

That said, I am also fine with having the tests live in scripts/tests/, if that doesn't complicate the travis set-up too much to also run those (I suppose now we everywhere only test pandas` directory?)

@WillAyd
Copy link
Member

WillAyd commented Aug 20, 2018

I'm -1 on moving to scripts/tests. If we are worried about the added size of the new module then we are making micro-optimizations whose benefit would pale in comparison to the effort making sure that we can account for tests that live outside of the tests directory

@gfyoung
Copy link
Member Author

gfyoung commented Aug 20, 2018

whose benefit would pale in comparison to the effort making sure that we can account for tests that live outside

@WillAyd : I'm not sure we can make this assertion yet without giving it a shot first. 😉

@gfyoung gfyoung force-pushed the install-scripts-tests branch from 189c585 to 9f2ad74 Compare August 20, 2018 18:52
Import the validation scripts from the scripts directory.

Because the scripts directory is above the top level pandas package,
we need to hack `sys.path` to know where to find it for import.
Copy link
Contributor

Choose a reason for hiding this comment

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

avoid the term 'hack'

Copy link
Member Author

Choose a reason for hiding this comment

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

That word was from the original docstring, but sure thing.

globals()[global_validate_one] = validate_one
except ImportError:
# Import will fail if the pandas installation is not inplace.
raise pytest.skip("scripts directory does not exist")
Copy link
Contributor

Choose a reason for hiding this comment

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

can you say pandas/scripts

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

If the pandas is not inplace, the scripts directory
will not exist, and the tests will fail.

Follow-up to pandas-devgh-20061.
@gfyoung gfyoung force-pushed the install-scripts-tests branch 2 times, most recently from 96ec3d7 to c14c540 Compare August 20, 2018 23:29
globals()[global_validate_one] = validate_one
except ImportError:
# Import will fail if the pandas installation is not inplace.
raise pytest.skip("pandas/scripts directory does not exist")
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if this causes an issue but from what I've tested locally if using the imperative skip validate_docstrings stays in globals as does the modification to system path. Perhaps we should ensure that code gets executed in the except block here?

Copy link
Member Author

@gfyoung gfyoung Aug 21, 2018

Choose a reason for hiding this comment

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

  • Fair point regarding system path modification.
  • Not sure how validate_docstrings stays in globals if the import fails in the first place...

Copy link
Member Author

Choose a reason for hiding this comment

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

@WillAyd : Addressed the change in follow-up (#22456)

@jreback jreback merged commit 9c35865 into pandas-dev:master Aug 21, 2018
@jreback
Copy link
Contributor

jreback commented Aug 21, 2018

let's see if this fixes the wheels

@jreback
Copy link
Contributor

jreback commented Aug 21, 2018

@gfyoung gfyoung deleted the install-scripts-tests branch August 22, 2018 05:56
gfyoung added a commit to forking-repos/pandas that referenced this pull request Aug 22, 2018
gfyoung added a commit to forking-repos/pandas that referenced this pull request Aug 22, 2018
jreback pushed a commit that referenced this pull request Aug 22, 2018
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
If the pandas is not inplace, the scripts directory
will not exist, and the tests will fail.

Follow-up to pandas-devgh-20061.
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Build Library building on various platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants