TST: Enable pytest-xdist #7468

Merged
merged 1 commit into from Dec 2, 2016
Jump to file
+7 −4
Split
View
@@ -45,13 +45,10 @@ env:
- NPROC=2
- TEST_ARGS=--no-pep8
- NOSE_ARGS="-j $NPROC"
- - PYTEST_ARGS="-ra --timeout=300 --durations=25 --cov-report= --cov=lib" # -n $NPROC
+ - PYTEST_ARGS="-ra --timeout=300 --durations=25 --cov-report= --cov=lib -n $NPROC"
- PYTHON_ARGS=
- DELETE_FONT_CACHE=
- USE_PYTEST=false
- #- PYTHONHASHSEED=0 # Workaround for pytest-xdist flaky colletion order
- # # https://github.com/pytest-dev/pytest/issues/920
- # # https://github.com/pytest-dev/pytest/issues/1075
matrix:
include:
@@ -166,6 +163,12 @@ script:
gdb -return-child-result -batch -ex r -ex bt --args python $PYTHON_ARGS tests.py $NOSE_ARGS $TEST_ARGS
fi
else
+ # Workaround for pytest-xdist flaky colletion order
+ # https://github.com/pytest-dev/pytest/issues/920
+ # https://github.com/pytest-dev/pytest/issues/1075
+ export PYTHONHASHSEED=$(shuf -i 1-4294967295 -n 1)
+ echo PYTHONHASHSEED=$PYTHONHASHSEED
@QuLogic

QuLogic Nov 17, 2016

Member

Will this affect the determinism tests?

@tacaswell

tacaswell Nov 17, 2016

Owner

Aren't the tests that really care about this run in a shell-call with their own seeds set?

@QuLogic

QuLogic Nov 17, 2016

Member

I don't see it set/unset PYTHONHASHSEED, so wouldn't it be inherited?

@tacaswell

tacaswell Nov 17, 2016

Owner

Yeah, I think you are right 🐑

@Kojoley

Kojoley Nov 17, 2016

Member

Well, I have find out that xdist collection problem is triggered by test_mathtext.py, but I do not know what exactly, maybe globals() injection magic or something else. I think the best option for us is to rewrite test_mathtext to pytest fixtures and forget about this xdist issue.

@QuLogic

QuLogic Nov 18, 2016

Member

Hmm, that definitely is weird; is there a way to parametrize the fileename passed to the image_comparison decorator?

+
echo The following args are passed to pytest $PYTEST_ARGS
py.test $PYTEST_ARGS $TEST_ARGS
fi