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

Allow selection of os dependent FS semantics #1091

Closed
markusschaber opened this issue Feb 21, 2024 · 3 comments
Closed

Allow selection of os dependent FS semantics #1091

markusschaber opened this issue Feb 21, 2024 · 3 comments
Labels
state: needs discussion Issues that need further discussion type: enhancement Issues that propose new functionality

Comments

@markusschaber
Copy link

Is your feature request related to a problem? Please describe.
Our CI pipeline currently is Linux only, but we also want to unit test our code which handles windows paths. On the other hand, our dev machines are mostly windows, so it's hard to test/debug Linux specific path handling.

Describe the solution you'd like
An option when constructing the MockFileSystem to choose to emulate Window/Linux/MacOS behaviour (the default would be determined from the current platform, as it is now.)

Describe alternatives you've considered
I tried the Testably.Abstractions Mock File System, they also don't support choosing of the semantics to emulate.

Additional context

@markusschaber markusschaber added state: needs discussion Issues that need further discussion type: enhancement Issues that propose new functionality labels Feb 21, 2024
@vbreuss
Copy link
Member

vbreuss commented Feb 21, 2024

Discussion with some arguments started in Testably/Testably.Abstractions#460.

@markusschaber
Copy link
Author

markusschaber commented Feb 22, 2024

Yeah, sorry for distracting you.

I found that the Testably mock file system might be the better way to go, as the TestableIO TestHelpers implementation has lots of small problems and bugs where it shows different behavior than the "real" File System (e. G. IDirectoryInfo.Exists returns true when the path points to a file, etc.) - we have some hundred unit tests which fail or show otherwise strange behavior when running against System.IO.Abstractions.TestingHelpers.MockFileSystem while they work fine against the real System.IO.Abstractions.FileSystem, both on Windows and Linux.

I'm waiting for one of our internal dependencies to update their System.IO.Abstractions to a current release, which allows me to also upgrade, and thus use Testably. (Currently, I get strange errors when I update my code as some types have moved assemblies between System.IO.Abstractions 16.x and TestableIO 20.x.)

Feel free to close the issue on this project. Thank you very much.

Edit: Our tests have been with System.IO.Abstractions version 16.x, which had been pulled in due to a 3rd dependency which has not been updated. It looks like some of the problems have already been fixed with System.IO.Abstractions 20.x. My snarky remark above should not be considered a rant about the quality of this project. :-(

@vbreuss
Copy link
Member

vbreuss commented Mar 2, 2024

Will be implemented in Testably/Testably.Abstractions#460.

@vbreuss vbreuss closed this as completed Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: needs discussion Issues that need further discussion type: enhancement Issues that propose new functionality
Projects
None yet
Development

No branches or pull requests

2 participants