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

FIX: Only remove temporary folder if it is present #4379

Merged
merged 4 commits into from
Oct 27, 2020

Conversation

chrisjsewell
Copy link
Member

Surprised no one has had this issue before, but on OSX at least this shutil.rmtree fails if retrieved_temporary_folder is None:

TypeError: lstat: path should be string, bytes or os.PathLike, not NoneType

@codecov
Copy link

codecov bot commented Sep 17, 2020

Codecov Report

Merging #4379 into develop will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #4379      +/-   ##
===========================================
+ Coverage    79.29%   79.30%   +0.01%     
===========================================
  Files          476      476              
  Lines        34958    34959       +1     
===========================================
+ Hits         27718    27720       +2     
+ Misses        7240     7239       -1     
Flag Coverage Δ
#django 73.17% <100.00%> (+0.01%) ⬆️
#sqlalchemy 72.38% <100.00%> (-<0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
aiida/engine/processes/calcjobs/calcjob.py 82.76% <100.00%> (+0.05%) ⬆️
aiida/transports/plugins/local.py 81.29% <0.00%> (-0.25%) ⬇️
aiida/engine/daemon/client.py 73.57% <0.00%> (+1.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9460e4e...bdca007. Read the comment docs.

@sphuber
Copy link
Contributor

sphuber commented Sep 17, 2020

This line

shutil.rmtree(retrieved_temporary_folder, ignore_errors=True)

might then also bite us in the ass on OS at some time. For now it is never None because the temporary directory is always created and passed. Why is Mac OS so shit? ;)

@chrisjsewell
Copy link
Member Author

Why is Mac OS so shit? ;)

You mean because it does the right thing 😉 bet this would fail a type check

@chrisjsewell
Copy link
Member Author

BTW, as mentioned in #4375 (comment), I was just trying to get all the tests to pass locally;

The tests/cmdline/commands/test_daemon.py::TestVerdiDaemon tests fail, is that expected, if you are just using the temporary profile creation?

@chrisjsewell
Copy link
Member Author

Also, after the passing tests finish, I get 100s of the same message:

Exception ignored in: <generator object create_task.<locals>.run_task at 0x7f84deb94e50>
Traceback (most recent call last):
  File "/Users/chrisjsewell/Documents/GitHub/aiida_core_develop/.tox/py37-django/lib/python3.7/site-packages/plumpy/futures.py", line 102, in run_task
  File "/Users/chrisjsewell/Documents/GitHub/aiida_core_develop/.tox/py37-django/lib/python3.7/contextlib.py", line 158, in __exit__
AttributeError: 'NoneType' object has no attribute 'exc_info'

which doesn't seem healthy 😬

@sphuber
Copy link
Contributor

sphuber commented Sep 17, 2020

Also, after the passing tests finish, I get 100s of the same message:

This has been fixed in the latest plumpy. Just install the latest patch version and those will go away.

@sphuber
Copy link
Contributor

sphuber commented Sep 17, 2020

BTW, as mentioned in #4375 (comment), I was just trying to get all the tests to pass locally;

The tests/cmdline/commands/test_daemon.py::TestVerdiDaemon tests fail, is that expected, if you are just using the temporary profile creation?

Cannot say without having a closer look. Would it make sense to hold of with merging this and trying to tackle the rest as well and go in one go?

@chrisjsewell
Copy link
Member Author

Would it make sense to hold of with merging this and trying to tackle the rest as well and go in one go?

Up to you

For the sphinx ones, not sure if this will solve it, but it would probably be better to use the "proper" sphinx test fixtures: https://github.com/sphinx-doc/sphinx/blob/3.x/sphinx/testing/fixtures.py

For the TestVerdiDaemon ones, it would be helpful to know if pytest tests/cmdline/commands/test_daemon.py and/or tox -- tests/cmdline/commands/test_daemon.py simply passes on Linux, or if you need to use a "pre-created" profile like in .github/workflows/ci-code.yml:jobs:tests

@sphuber
Copy link
Contributor

sphuber commented Sep 18, 2020

For the TestVerdiDaemon ones, it would be helpful to know if pytest tests/cmdline/commands/test_daemon.py and/or tox -- tests/cmdline/commands/test_daemon.py simply passes on Linux, or if you need to use a "pre-created" profile like in .github/workflows/ci-code.yml:jobs:tests

Nope, with on the fly profile this also fails on Ubuntu. However with existing profile this works just fine.

@chrisjsewell chrisjsewell changed the title 🧪 Fix tests/engine/test_calc_job.py on OSX Only remove temprorary folder if it is present Oct 27, 2020
@chrisjsewell chrisjsewell changed the title Only remove temprorary folder if it is present FIX: Only remove temprorary folder if it is present Oct 27, 2020
@chrisjsewell chrisjsewell changed the title FIX: Only remove temprorary folder if it is present FIX: Only remove temporary folder if it is present Oct 27, 2020
@chrisjsewell
Copy link
Member Author

I'm merging this, since its a trivial thing

@chrisjsewell chrisjsewell merged commit 02c8a0c into aiidateam:develop Oct 27, 2020
@chrisjsewell chrisjsewell deleted the tests/fix-osx branch October 27, 2020 18:53
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

Successfully merging this pull request may close these issues.

2 participants