Skip to content

CI: Running tests with xvfb for the clipboard to work #26932

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

Closed
wants to merge 8 commits into from
Closed

CI: Running tests with xvfb for the clipboard to work #26932

wants to merge 8 commits into from

Conversation

datapythonista
Copy link
Member

With some luck this should make the clipboard tests work in azure. @jorisvandenbossche @jreback can you have a look once the CI finishes?

@datapythonista datapythonista added Testing pandas testing functions or related to the test suite CI Continuous Integration labels Jun 18, 2019
@datapythonista
Copy link
Member Author

No idea why xvfb manages to start in some Linux builds, and fails in others. The only difference should be the conda packages installed, that I don't think it should affect xvfb.

And it also worries me, that in my fork pipelines (I set it up to test changes to the CI), things fail that don't fail here. I feel like I was dealing with windows 95... :\

@datapythonista
Copy link
Member Author

In the build Linux py37_locale this seems to be working as expected for what I see. Clipboard tests are usually shown in the print skipped section, and here they are not. So looks like the problem is that there is something different in the Linux py35_compat build, that is making xvfb fail to start.

@datapythonista
Copy link
Member Author

I see that xvfb actually starts the first time, and fails the second execution. I guess the problem may be that it doesn't have time to switch off before it's reloaded, will see what I can do.

@@ -46,6 +46,11 @@ do
fi

PYTEST_CMD="pytest -m \"$TYPE_PATTERN$PATTERN\" -n $NUM_JOBS -s --strict --durations=10 --junitxml=test-data-$TYPE.xml $TEST_ARGS $COVERAGE pandas"
if [[ "$(uname)" == "Linux" ]]; then
# This is required for the clipboard to work (X virtual frambuffer implements the X server API, required by the clipboard tools, without running an actual X server)
DISPLAY=:99.0
Copy link
Contributor

Choose a reason for hiding this comment

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

so u prob need to start xvfb much earlier and background it

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm using xvfb-run, which starts it for the command, and stops it when the command finishes. It's what xvfb's got in the azure servers. I guess something else can be installed, but I'll see what I can do.

May be time to try again to call the tests just once (not twice for single and multi). :)

Copy link
Member

Choose a reason for hiding this comment

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

I think I’ve seen similar things for matplotlib headless tests. IIRC they add a 1-second sleep after this for the thing to start

@jorisvandenbossche
Copy link
Member

Maybe try in a step before?

On Travis, they explicitly say in their docs it needs to be run in the "before_script" section (so the section where the tests are run)

@datapythonista datapythonista changed the title CI: Running tests with xfvb for the clipboard to work DO NOT MERGE/CI: Running tests with xfvb for the clipboard to work Jun 19, 2019
@datapythonista
Copy link
Member Author

I think the sleep 1 will fix it, actually I did another run and worked correctly. Will play a bit more with it.

@jorisvandenbossche not an expert, but what I'm doing now is a bit different than what we've got in travis. In travis we just start the xvfb, and leaving it running. Here I use xvfb-run, which is like a Python context manager, it wraps a command with the server. If we use this, can't really move to another step, as I'm calling xvfb, and xvfb is calling the tests.

@datapythonista
Copy link
Member Author

Confirmed that the problem is that xvfb fails to start because it's still running from the previous execution.

I can do a sleep for now if you want to get this in faster, but I think the right solution is the approach in #24106

I see that in travis the same solution doesn't seem to work, and clipboard tests are skipped. :\

@codecov
Copy link

codecov bot commented Jun 19, 2019

Codecov Report

Merging #26932 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26932      +/-   ##
==========================================
- Coverage   91.87%   91.86%   -0.01%     
==========================================
  Files         180      180              
  Lines       50716    50743      +27     
==========================================
+ Hits        46593    46617      +24     
- Misses       4123     4126       +3
Flag Coverage Δ
#multiple 90.46% <ø> (ø) ⬆️
#single 41.12% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 88.88% <0%> (-11.12%) ⬇️
pandas/core/frame.py 96.89% <0%> (-0.12%) ⬇️
pandas/core/strings.py 98.93% <0%> (ø) ⬆️
pandas/core/indexes/base.py 96.71% <0%> (ø) ⬆️
pandas/core/internals/managers.py 95.21% <0%> (ø) ⬆️
pandas/core/generic.py 94.2% <0%> (ø) ⬆️
pandas/core/series.py 93.66% <0%> (+0.01%) ⬆️
pandas/core/indexes/multi.py 95.73% <0%> (+0.06%) ⬆️
pandas/util/testing.py 90.94% <0%> (+0.1%) ⬆️
pandas/io/formats/printing.py 86.72% <0%> (+1.16%) ⬆️

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 d39a6de...004d2d0. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 19, 2019

Codecov Report

Merging #26932 into master will decrease coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26932      +/-   ##
==========================================
- Coverage   91.87%   91.86%   -0.01%     
==========================================
  Files         180      180              
  Lines       50743    50743              
==========================================
- Hits        46620    46616       -4     
- Misses       4123     4127       +4
Flag Coverage Δ
#multiple 90.46% <ø> (ø) ⬆️
#single 41.1% <ø> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 88.88% <0%> (-11.12%) ⬇️
pandas/core/frame.py 96.89% <0%> (-0.12%) ⬇️

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 d47947a...3a6c641. Read the comment docs.

@jorisvandenbossche
Copy link
Member

I see that in travis the same solution doesn't seem to work, and clipboard tests are skipped. :\

In the previous PR where I fixed those tests, I moved it back from run_tests.sh to before_script exactly because it was not working there (as said, it's in the documentation of travis it needs to be there).

You're free to try to find a solution that works for both, but personally I wouldn't spend too much time on that if you have something that works for Azure.

@datapythonista datapythonista changed the title DO NOT MERGE/CI: Running tests with xfvb for the clipboard to work CI: Running tests with xfvb for the clipboard to work Jun 19, 2019
@datapythonista
Copy link
Member Author

Going for the simple hacking solution for now, so the tests start running.

If I have time I'll give another try to call pytest just once, that will solve the problem for azure, and simplify the CI significantly.

@datapythonista datapythonista changed the title CI: Running tests with xfvb for the clipboard to work CI: Running tests with xvfb for the clipboard to work Jun 19, 2019
@datapythonista
Copy link
Member Author

Closing this, as I think it make more sense to implement those changes in a fresh PR after #26949 is merged (which will simplify this significantly).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI Continuous Integration Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CI: read_clipboard / to_clipboard not working in Azure
4 participants