Skip to content
5 changes: 5 additions & 0 deletions ci/azure/posix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,22 @@ jobs:
echo "Creating Environment"
ci/setup_env.sh
displayName: 'Setup environment and build pandas'

- script: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
ci/run_tests.sh
displayName: 'Test'

- script: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd

- task: PublishTestResults@2
inputs:
testResultsFiles: 'test-data-*.xml'
testRunTitle: ${{ format('{0}-$(CONDA_PY)', parameters.name) }}

- powershell: |
$junitXml = "test-data-single.xml"
$(Get-Content $junitXml | Out-String) -match 'failures="(.*?)"'
Expand All @@ -90,6 +94,7 @@ jobs:
Write-Error "$($matches[1]) tests failed"
}
displayName: 'Check for test failures'

- script: |
export PATH=$HOME/miniconda3/bin:$PATH
source activate pandas-dev
Expand Down
11 changes: 11 additions & 0 deletions ci/run_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,20 @@ 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"
echo $AGENT_OS
if [[ "$AGENT_OS" == "Linux" ]]; then
echo "Emulating X server with xvfb for clipboard tests to run (this should only be displayed in Linux build of Azure Pipelines)"
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

PYTEST_CMD="xvfb-run $PYTEST_CMD"
# Sleeping a bit the second time we execute the tests with xvfb to make sure the previous execution finished
if [ -n $PYTEST_PID ]; then
timeout 60 tail --pid=$pid -f /dev/null
fi
fi
echo $PYTEST_CMD
# if no tests are found (the case of "single and slow"), pytest exits with code 5, and would make the script fail, if not for the below code
sh -c "$PYTEST_CMD; ret=\$?; [ \$ret = 5 ] && exit 0 || exit \$ret"
PYTEST_PID=$!

if [[ "$COVERAGE" && $? == 0 ]]; then
echo "uploading coverage for $TYPE tests"
Expand Down