Skip to content

Commit 6f23c45

Browse files
datapythonistaMateusz Górski
authored and
Mateusz Górski
committed
TST: Call tests just once with --dist=loadscope (pandas-dev#28531)
1 parent e037d53 commit 6f23c45

File tree

6 files changed

+34
-69
lines changed

6 files changed

+34
-69
lines changed

.travis.yml

-9
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,6 @@ install:
8585
- ci/submit_cython_cache.sh
8686
- echo "install done"
8787

88-
89-
before_script:
90-
# display server (for clipboard functionality) needs to be started here,
91-
# does not work if done in install:setup_env.sh (GH-26103)
92-
- export DISPLAY=":99.0"
93-
- echo "sh -e /etc/init.d/xvfb start"
94-
- if [ "$JOB" != "3.8-dev" ]; then sh -e /etc/init.d/xvfb start; fi
95-
- sleep 3
96-
9788
script:
9889
- echo "script start"
9990
- echo "$JOB"

ci/azure/posix.yml

+6-23
Original file line numberDiff line numberDiff line change
@@ -73,33 +73,16 @@ jobs:
7373

7474
- task: PublishTestResults@2
7575
inputs:
76-
testResultsFiles: 'test-data-*.xml'
76+
testResultsFiles: 'test-data.xml'
7777
testRunTitle: ${{ format('{0}-$(CONDA_PY)', parameters.name) }}
7878
displayName: 'Publish test results'
7979

8080
- powershell: |
81-
$junitXml = "test-data-single.xml"
82-
$(Get-Content $junitXml | Out-String) -match 'failures="(.*?)"'
83-
if ($matches[1] -eq 0)
84-
{
85-
Write-Host "No test failures in test-data-single"
86-
}
87-
else
88-
{
89-
# note that this will produce $LASTEXITCODE=1
90-
Write-Error "$($matches[1]) tests failed"
91-
}
92-
93-
$junitXmlMulti = "test-data-multiple.xml"
94-
$(Get-Content $junitXmlMulti | Out-String) -match 'failures="(.*?)"'
95-
if ($matches[1] -eq 0)
96-
{
97-
Write-Host "No test failures in test-data-multi"
98-
}
99-
else
100-
{
101-
# note that this will produce $LASTEXITCODE=1
102-
Write-Error "$($matches[1]) tests failed"
81+
$(Get-Content "test-data.xml" | Out-String) -match 'failures="(.*?)"'
82+
if ($matches[1] -eq 0) {
83+
Write-Host "No test failures in test-data"
84+
} else {
85+
Write-Error "$($matches[1]) tests failed" # will produce $LASTEXITCODE=1
10386
}
10487
displayName: 'Check for test failures'
10588

ci/print_skipped.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,13 @@ def main(filename):
2727
if __name__ == "__main__":
2828
print("SKIPPED TESTS:")
2929
i = 1
30-
for file_type in ("-single", "-multiple", ""):
31-
for test_data in main("test-data{}.xml".format(file_type)):
32-
if test_data is None:
33-
print("-" * 80)
34-
else:
35-
print(
36-
"#{i} {class_name}.{test_name}: {message}".format(
37-
**dict(test_data, i=i)
38-
)
30+
for test_data in main("test-data.xml"):
31+
if test_data is None:
32+
print("-" * 80)
33+
else:
34+
print(
35+
"#{i} {class_name}.{test_name}: {message}".format(
36+
**dict(test_data, i=i)
3937
)
40-
i += 1
38+
)
39+
i += 1

ci/run_tests.sh

+17-25
Original file line numberDiff line numberDiff line change
@@ -15,37 +15,29 @@ if [ -n "$LOCALE_OVERRIDE" ]; then
1515
# exit 1
1616
fi
1717
fi
18+
1819
if [[ "not network" == *"$PATTERN"* ]]; then
1920
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
2021
fi
2122

22-
23-
if [ -n "$PATTERN" ]; then
24-
PATTERN=" and $PATTERN"
23+
if [ "$COVERAGE" ]; then
24+
COVERAGE_FNAME="/tmp/test_coverage.xml"
25+
COVERAGE="-s --cov=pandas --cov-report=xml:$COVERAGE_FNAME"
2526
fi
2627

27-
for TYPE in single multiple
28-
do
29-
if [ "$COVERAGE" ]; then
30-
COVERAGE_FNAME="/tmp/coc-$TYPE.xml"
31-
COVERAGE="-s --cov=pandas --cov-report=xml:$COVERAGE_FNAME"
32-
fi
28+
PYTEST_CMD="pytest -m \"$PATTERN\" -n auto --dist=loadfile -s --strict --durations=10 --junitxml=test-data.xml $TEST_ARGS $COVERAGE pandas"
3329

34-
TYPE_PATTERN=$TYPE
35-
NUM_JOBS=1
36-
if [[ "$TYPE_PATTERN" == "multiple" ]]; then
37-
TYPE_PATTERN="not single"
38-
NUM_JOBS=2
39-
fi
30+
# Travis does not have have an X server
31+
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
32+
DISPLAY=DISPLAY=:99.0
33+
PYTEST_CMD="xvfb-run -e /dev/stdout $PYTEST_CMD"
34+
fi
4035

41-
PYTEST_CMD="pytest -m \"$TYPE_PATTERN$PATTERN\" -n $NUM_JOBS -s --strict --durations=10 --junitxml=test-data-$TYPE.xml $TEST_ARGS $COVERAGE pandas"
42-
echo $PYTEST_CMD
43-
# 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
44-
sh -c "$PYTEST_CMD; ret=\$?; [ \$ret = 5 ] && exit 0 || exit \$ret"
36+
echo $PYTEST_CMD
37+
sh -c "$PYTEST_CMD"
4538

46-
if [[ "$COVERAGE" && $? == 0 && "$TRAVIS_BRANCH" == "master" ]]; then
47-
echo "uploading coverage for $TYPE tests"
48-
echo "bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME"
49-
bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME
50-
fi
51-
done
39+
if [[ "$COVERAGE" && $? == 0 && "$TRAVIS_BRANCH" == "master" ]]; then
40+
echo "uploading coverage"
41+
echo "bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME"
42+
bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME
43+
fi

environment.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ dependencies:
5353
- moto # mock S3
5454
- pytest>=4.0.2
5555
- pytest-cov
56-
- pytest-xdist
56+
- pytest-xdist>=1.21
5757
- seaborn
5858
- statsmodels
5959

requirements-dev.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ hypothesis>=3.82
3232
moto
3333
pytest>=4.0.2
3434
pytest-cov
35-
pytest-xdist
35+
pytest-xdist>=1.21
3636
seaborn
3737
statsmodels
3838
ipywidgets

0 commit comments

Comments
 (0)