Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_config is not parallel-safe #3104

Closed
Xarthisius opened this issue Feb 27, 2021 · 0 comments
Closed

test_config is not parallel-safe #3104

Xarthisius opened this issue Feb 27, 2021 · 0 comments

Comments

@Xarthisius
Copy link
Member

Bug report

Bug summary

During the execution of yt/utilities/tests/test_config.py we modify the actual <XDG_CONFIG_HOME>/yt/yt.toml. This is problematic since tests run in parallel as separate processes and can pick up whatever garbage is being dumped into temporary yt configuration. This can manifest as e.g.:

THIS IS THE REAL CAUSE OF THE FAILURE:
Traceback (most recent call last):
  File "doc/source/cookbook/custom_transfer_function_volume_rendering.py", line 6, in <module>
    ds = yt.load("Enzo_64/DD0043/data0043")
  File "/home/fido/workspace/yt_py38_latest_deps/yt/loaders.py", line 86, in load
    raise FileNotFoundError(msg)
FileNotFoundError: No such file or directory: 'Enzo_64/DD0043/data0043'.

Entire thing went unnoticed cause until yesterday test suite didn't rely on config file. Instead I was doing the following:

 sed -i -e '/test_data_dir/ s:/does/not/exist:/mnt/yt:g' \
    -e '/xray_data_dir/ s:/does/not/exist:/mnt/yt/xray_data:g' \
    -e '/supp_data_dir/ s:/does/not/exist:/mnt/yt/supp_data:g' \
    -e '/__strict_requires/ s/False/True/g' \
    -e '/suppressstreamlogging/ s/False/True/g' yt/config.py

prior to test execution to set whatever is necessary, which is now restored back.

Code for reproduction

$ sudo chown root:root -R $HOME/.config/yt 
$ nosetests -s -vv yt/utilities/tests/test_config.py

Actual outcome

======================================================================
ERROR: test suite for <module 'yt.utilities.tests.test_config' from '/home/xarth/codes/xarthisius/yt/yt/utilities/tests/test_config.py'>
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xarth/codes/xarthisius/yt/pytest/lib/python3.8/site-packages/nose/suite.py", line 210, in run
    self.setUp()
  File "/home/xarth/codes/xarthisius/yt/pytest/lib/python3.8/site-packages/nose/suite.py", line 293, in setUp
    self.setupContext(ancestor)
  File "/home/xarth/codes/xarthisius/yt/pytest/lib/python3.8/site-packages/nose/suite.py", line 316, in setupContext
    try_run(context, names)
  File "/home/xarth/codes/xarthisius/yt/pytest/lib/python3.8/site-packages/nose/util.py", line 471, in try_run
    return func()
  File "/home/xarth/codes/xarthisius/yt/yt/utilities/tests/test_config.py", line 54, in setUpModule
    os.rename(cfgfile, cfgfile + ".bak_test")
PermissionError: [Errno 13] Permission denied: '/home/xarth/.config/yt/yt.toml' -> '/home/xarth/.config/yt/yt.toml.bak_test'

Expected outcome

Config not modified.

Xarthisius added a commit to Xarthisius/yt that referenced this issue Feb 27, 2021
Xarthisius added a commit to Xarthisius/yt that referenced this issue Feb 27, 2021
Xarthisius added a commit to Xarthisius/yt that referenced this issue Feb 27, 2021
Xarthisius added a commit to Xarthisius/yt that referenced this issue Mar 8, 2021
Xarthisius added a commit that referenced this issue Mar 10, 2021
Make config related paths dynamical. Fixes #3104
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant