In running flutter test on MacOS I am getting this error:
FileSystemException: Creation failed, path = '/mock' (OS Error: Read-only file system, errno = 30)
Note that it is working fine on Windows and Ubuntu.
I am using the path_provider package, following this example here:
https://github.com/flutter/packages/blob/main/packages/path_provider/path_provider/test/path_provider_test.dart
and overriding the values:
import "package:flutter_test/flutter_test.dart";
import "package:path_provider_platform_interface/path_provider_platform_interface.dart"
show PathProviderPlatform, StorageDirectory;
import "package:plugin_platform_interface/plugin_platform_interface.dart";
const String kTemporaryPath = "/mock/temporaryPath";
class MockPathProviderPlatform extends Mock
with MockPlatformInterfaceMixin
implements PathProviderPlatform {
@override
Future<String> getTemporaryPath() async {
return kTemporaryPath;
}
I tried to change permissions in the current directory with
sudo chmod -R 777 <current-directory but it didn't help.
The fix was to remove the leading
/in thekTemporaryPathAlso, good idea to add the
mockdirectory (or however you named it) directory in.gitignore