New-style Path | str union doesn't seem to work in fixture
#1242
-
|
I have a fixture that uses Recently I updated Ruff to replace the old-style Am I missing something? Here's the fixture: @pytest.fixture
def mock_non_audio(audio_files: AudioFileTest, monkeypatch) -> Callable[..., Path]:
"""Fixture providing mocked non-audio file functionality."""
monkeypatch.setattr(AudioFile, "load", audio_files.load)
def create_non_audio_file(
path: Union[Path, str], # This Union is critical for pyfakefs!
size: int = 4000,
) -> Path:
"""Create and configure a mock non-audio file."""
assert audio_files._fs is not None
return audio_files._fs.create_file(path, st_size=size)
return create_non_audio_fileAnd when switched to a |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
|
Thanks - that's very strange, and currently I have no idea what could cause that. |
Beta Was this translation helpful? Give feedback.
-
|
I am able to create a standalone test that reproduces the TypeError you got (unsupported operand) , but I haven't been able to get my original problem reproduced in a standalone test (yet?). I was also able to make the standalone work with |
Beta Was this translation helpful? Give feedback.
-
|
I still did not really understand the problem, but I added a workaround that should fix it. You can check if the main branch works for you. |
Beta Was this translation helpful? Give feedback.
-
|
I patched my install with the updated |
Beta Was this translation helpful? Give feedback.
I still did not really understand the problem, but I added a workaround that should fix it. You can check if the main branch works for you.