       fixture = fixture_path("file.txt")
       invalid = Path.join fixture, "test"
       assert File.exists?(fixture)
-      assert_raise File.Error, "could not make directory (with -p) #{invalid}: not a directory", fn ->
+      assert_raise File.Error, %r"^could not make directory \(with -p\) #{escape invalid}: (not a directory|no such file or directory)", fn ->
         File.mkdir_p!(invalid)
       end
     end

  end

  test :invalid_cd! do
    message = "could not set current working directory to #{fixture_path("file.txt")}: not a directory"
    assert_raise File.Error, message, fn ->
      File.cd!(fixture_path("file.txt"))
    end

      fixture = fixture_path("file.txt")
      invalid = Path.join fixture, "test"
      assert File.exists?(fixture)
      assert_raise File.Error, %r"^could not make directory #{escape invalid}: (not a directory|no such file or directory)", fn ->
        File.mkdir!(invalid)
      end
    end
