Repository navigation
TST: astropy/time/tests/test_methods.py might trigger race condition in parallel job #11966
Copy link
Copy link
Closed
Description
As @WilliamJamieson noticed in #11930 , the way that astropy/time/tests/test_methods.py uses its fixture and global variable might trigger race condition in parallel job under very specific circumstances. A refactor might be necessary, Looks like @taldcroft added this in #6028 .
Example log: https://github.com/astropy/astropy/pull/11930/checks?check_run_id=3128121184
_______________ ERROR at setup of TestShapeFunctions.test_fliplr _______________
[gw0] linux -- Python 3.7.11 /__w/astropy/astropy/.tox/py37-test/bin/python
cls = <class 'astropy.time.tests.test_methods.TestShapeFunctions'>
def setup_class(cls):
mjd = np.arange(50000, 50010)
frac = np.arange(0., 0.999, 0.2)
> if use_masked_data:
E NameError: name 'use_masked_data' is not defined
../../.tox/py37-test/lib/python3.7/site-packages/astropy/time/tests/test_methods.py:38: NameError
_______________ ERROR at setup of TestShapeFunctions.test_rot90 ________________
[gw0] linux -- Python 3.7.11 /__w/astropy/astropy/.tox/py37-test/bin/python
cls = <class 'astropy.time.tests.test_methods.TestShapeFunctions'>
def setup_class(cls):
mjd = np.arange(50000, 50010)
frac = np.arange(0., 0.999, 0.2)
> if use_masked_data:
E NameError: name 'use_masked_data' is not defined
../../.tox/py37-test/lib/python3.7/site-packages/astropy/time/tests/test_methods.py:38: NameError
________________ ERROR at setup of TestShapeFunctions.test_roll ________________
[gw0] linux -- Python 3.7.11 /__w/astropy/astropy/.tox/py37-test/bin/python
cls = <class 'astropy.time.tests.test_methods.TestShapeFunctions'>
def setup_class(cls):
mjd = np.arange(50000, 50010)
frac = np.arange(0., 0.999, 0.2)
> if use_masked_data:
E NameError: name 'use_masked_data' is not defined
../../.tox/py37-test/lib/python3.7/site-packages/astropy/time/tests/test_methods.py:38: NameError
_______________ ERROR at setup of TestShapeFunctions.test_delete _______________
[gw0] linux -- Python 3.7.11 /__w/astropy/astropy/.tox/py37-test/bin/python
cls = <class 'astropy.time.tests.test_methods.TestShapeFunctions'>
def setup_class(cls):
mjd = np.arange(50000, 50010)
frac = np.arange(0., 0.999, 0.2)
> if use_masked_data:
E NameError: name 'use_masked_data' is not defined
../../.tox/py37-test/lib/python3.7/site-packages/astropy/time/tests/test_methods.py:38: NameError
astropy/astropy/time/tests/test_methods.py
Lines 15 to 20 in 0b81dfd
| @pytest.fixture(scope="module", params=[True, False]) | |
| def masked(request): | |
| # Could not figure out a better way to parametrize the setup method | |
| global use_masked_data | |
| use_masked_data = request.param | |
| yield use_masked_data |
| if use_masked_data: |
Reactions are currently unavailable
Activity
pllim commentedon Jul 22, 2021
@WilliamJamieson was able to consistently reproduce this problem using a command similar to this locally from the affected PR's branch, though the PR changes have nothing to do with
astropy.time:astropy/.github/workflows/ci_workflows.yml
Line 169 in 0b81dfd
As he reported as well, the following did not trigger the race condition:
pytest -n=4 --durations=50python -m tox -e py37-test -- --durations=50WilliamJamieson commentedon Jul 26, 2021
I'll take a look at this, since its blocking my PR.