You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes it is useful to know the (name and) version of the package that a test_package is supposed to test.
Currently there is no supported way of doing this.
This is e.g. useful to ensure that the --version output of a packaged executable is the same as the version it is supposed to package.
Currently, I'm fetching the version using self.requires["package_name"].ref.version,
but I've been told that this is not a supported way.
That's why I am asking for clemency an official way to do this.
This is e.g. useful to ensure that the --version output of a packaged executable is the same as the version it is supposed to package.
Not sure if this is a good example. This is a "functional" test of the executable, and as such, should probably be run in the build() method of the main recipe, not the test_package. The test_package feature in Conan is intended to check that things were packaged correctly, the headers are there, the library is there, the runtime is there and it can be used. Not that the behavior is one or other. In other words, this is a failure you want to detect even before packaging, not after packaging. If for some reason the pipeline continues after this test_package you are trying to do fails, and uploads the packages, you will have a broken package in the server. Failures in test_package do not remove the created packages, they are still there, sitting in the cache.
So self.deps_cpp_info["package_name"].version should also get this information. Please try if this works.
If it works, I would suggest to document this version field at the moment, but probably to think a more structured way to get information from dependencies.
I'm testing it and the field self.deps_cpp_info["package_name"].version is not populated in the test packageconanfile.py. It was a good alternative, but it requires some development
Sometimes it is useful to know the (name and) version of the package that a test_package is supposed to test.
Currently there is no supported way of doing this.
This is e.g. useful to ensure that the
--version
output of a packaged executable is the same as the version it is supposed to package.Currently, I'm fetching the version using
self.requires["package_name"].ref.version
,but I've been told that this is not a supported way.
That's why I am asking for
clemencyan official way to do this.The text was updated successfully, but these errors were encountered: