-
Notifications
You must be signed in to change notification settings - Fork 91
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
problem with os.stat
within eyed3.load
when running multiple tests using fs
based fixture
#1105
Comments
Thanks for the report! |
If using your code with a dummy I would need a bit more information to be able to reproduce this, ideally a self-contained example, as I wrote above. |
Hi, I'll try to provide a minimal example tomorrow. |
Hi @mrbean-bremen , here is a minimal example that raises for me:
Each test running in isolation succeeds. But executing both tests in a sequence raises:
As you can see it complains |
Thanks a lot, I now can reproduce the problem! Still a bit at a loss as to the cause, but I will see what I can find. |
Thanks a lot in advance! And good luck :-) |
I'm quite sure that this is a bug in pyfakefs regarding the patching of @pytest.fixture
def test_fs():
with Patcher(use_dynamic_patch=False) as patcher:
yield patcher.fs as your fixture. This will fix the minimal test, but the dynamic patcher may still be needed for other tests, so this may or may not help you. |
Describe the bug
Hello together, I have hard times finding out what causes the following error: I am using the
fs
(notfs_module
etc. -> fs) inside a fixture. There is one test, that, when ran in isolation, succeeds. But when it runs together (sequentially) with any other test that uses thefs
based fixture it fails.TLDR
Of course the first thought is, are there any other filesystem actions colliding with the test but I think i ruled those out:
1:
fs
is used on a per test basis (as far as I can read from the docs onlyfs_module
etc. are scoped broader than function, right?)2: I added some debugging lines that verify the existence of the file which a code line later causes a fail. Also, before the failing line
os.stat
is called withineyed3.load
method, eyed3 performs some internal checks likeif not path.is_file()
that are passed. So the pure existance of the file should be given I think. more can be read here: https://github.com/nicfit/eyeD3/blob/2cdef0d7542e65cc2756d63c2afffbdf48061eea/eyed3/mp3/__init__.py#L93How To Reproduce
This is the test setup and test code up to the point where it raises:
The following code is where it leaves my codebase and raises the error within eyed3:
The resulting debugging output is this:
The error thrown/stacktrace is:
Your environment
Windows-11-10.0.22000-SP0
Python 3.12.3 (tags/v3.12.3:f6650f9, Apr 9 2024, 14:05:25) [MSC v.1938 64 bit (AMD64)]
pyfakefs 5.6.0
pytest 8.2.1
does such a scenario ring a bell of someone? What can I do to further track down the issue?
Kind regards!
The text was updated successfully, but these errors were encountered: