site-www icon indicating copy to clipboard operation
site-www copied to clipboard

could not find package test_utils

Open igouy opened this issue 3 years ago • 3 comments

Page URL

https://dart.dev/guides/libraries/c-interop#building-and-running

Page source

No response

Describe the problem

$ dart pub get
Resolving dependencies... 
Because hello_world_ffi depends on test_utils from path which doesn't exist (could
  not find package test_utils at "../test_utils"), version solving failed.

Expected fix

I expect "an example of building the dynamic library and executing the Dart app" to work when followed.

The "hello_world example has the following files" does not mention "../test_utils"

Additional context

No response

igouy avatar Mar 11 '22 18:03 igouy

Hi @igouy, thanks again for opening an issue.

I'm curious, did you just install the linked files in the instructions? Currently they are meant as more of an example to loosely follow and understand, not necessarily as a template. Therefore for testing purposes, it require files elsewhere in the samples repository.

I'm thinking we can make it clear it, that to test this example, you should start by cloning the samples repository and working on it from there. That way no files are missed and its easier than downloading files one by one. Then adding a comment in the pubspec.yaml that the extra dependency can be removed if it's their own project.

For your purposes, if you don't want to clone the entire samples repository to test it, you can simply remove the extra dependency on test_utils at the bottom of the pubspec.yaml: https://github.com/dart-lang/samples/blob/master/ffi/hello_world/pubspec.yaml#L18-L19

I'll work on those improvements, thanks again!

parlough avatar Mar 11 '22 23:03 parlough

I'm curious, did you just install the linked files in the instructions?

Yes I (not ironically) "literally" followed the instructions.

an example to loosely follow

It's hello world! Make it so I can copy and paste stuff into a terminal window and it just works.

igouy avatar Mar 13 '22 17:03 igouy

Thanks for clarifying!

I'll see if we can move everything within the directory to avoid the external directory dependency, making it easier to just copy and paste from the sample you want to use.

parlough avatar Mar 13 '22 17:03 parlough

@johnpryan : This looks like an error with the sample in the pubspec.yaml at line 22. It points to ../test_utils which does not exist in the sample. ../test/ does. If that's the case, could you update it? Thanks!

atsansone avatar Apr 29 '23 04:04 atsansone

The test_utils package is used for testing the sample. There might be a better way to test the sample without causing confusion.

johnpryan avatar May 01 '23 23:05 johnpryan