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

GitHub Actions get stuck when using fs fixture and importing torch #693

Closed
mniebisch opened this issue Jul 20, 2022 · 6 comments
Closed

Comments

@mniebisch
Copy link

mniebisch commented Jul 20, 2022

Hey,

I'm using pyfakefs for a project. While writing tests locally, everything worked like a charm.
At some point, I pushed my code and applied it to GitHub Action. During the test phase of my workflow, the tests just got stuck, and the workflow didn't terminate.

I tracked the problem down to a conflict between the fs fixture and the import of torch.
If torch is imported, all tests are executed until a test uses the fs fixture for the first time.

I reproduced the problem. You can find it here https://github.com/mniebisch/check_pyfakefs_github_action/runs/7429852799?check_suite_focus=true

Additionally, here's a screenshot showing that everything works just fine locally.
screenshot

I hope this isn't a known issue. My Google search didn't turn up any help. If so, I'm sorry :)

@mrbean-bremen
Copy link
Member

Thanks for the report! No, I don't know of this issue, and I have no idea what causes this so far.
I will have a closer look after I fix a couple of regression bugs that came up recently, so this may take a bit...

mrbean-bremen added a commit to mrbean-bremen/pyfakefs that referenced this issue Jul 22, 2022
- have been made in version 3.3.0,
  apparently cause hanging tests with torch import
- no performance degradation detected
- see pytest-dev#693
mrbean-bremen added a commit that referenced this issue Jul 23, 2022
- have been made in version 3.3.0,
  apparently cause hanging tests with torch import
- no performance degradation detected
- see #693
github-actions bot pushed a commit that referenced this issue Jul 23, 2022
….0, apparently cause hanging tests with torch import - no performance degradation detected - see #693
@mrbean-bremen
Copy link
Member

@mniebisch - Can you check if it is fixed with master?

@mniebisch
Copy link
Author

mniebisch commented Jul 25, 2022

@mrbean-bremen - I checked with pyfakefs 3.6.3. Unfortunately, it doesn't work.

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Jul 25, 2022

@mniebisch - it is not integrated into a release yet - can you please check with master?
e.g.

pip install git+https://github.com/jmcgeheeiv/pyfakefs.git@master

@mniebisch
Copy link
Author

mniebisch commented Jul 25, 2022

@mrbean-bremen Ah, my bad :D Seems like I need a coffee. Your fix works like a charm. Thanks a lot for the fast support :) What caused the problem

@mrbean-bremen
Copy link
Member

mrbean-bremen commented Jul 25, 2022

That's good! I'm not completely sure what caused it as I could not reproduce it locally - I just found the commit and the specific changes that caused this in CI. It seems that accessing __name__ in non-module objects did not behave as expected (e.g. instead of raising an exception it caused the test to hang). I reintroduced the module check using inspect, that I had removed as a performance optimization some time ago. The performance seems not to be affected anyway, at least for newer Python versions.
I will check if I can resolve another open issue and probably make another patch release afterwards.

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

2 participants