Skip to content

TST: astropy/time/tests/test_methods.py might trigger race condition in parallel job #11966

Description

@pllim

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

@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:

Metadata

Metadata

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions