conan: [bug] Regression from v2.7.1: "Required package 'nlohmann_json' not in component 'requires'"

Describe the bug

I have a package that test-depends on nhlohmann_json:

    def requirements(self):
        self.requires('something/[~1]@company/main', transitive_headers=True)

    def build_requirements(self):
        self.test_requires('nlohmann_json/3.10.4')

    def package_info(self):
        self.cpp_info.libs = ["MyLib"]
        self.cpp_info.requires = [
            'something::a_component',
        ]

When creating the package with conan v2.8.0, I get the error Required package 'nlohmann_json' not in component 'requires' after package gets built and test_package is executed to test the packaging.

As you can see, nlohmann_json is just a test dependency, so it doesn’t need to be listed in self.cpp_info.requires.

Downgrading to v2.7.1 helps fixing the issue (v2.7.1 correctly builds and tests the package).

How to reproduce it

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 19 (19 by maintainers)

Most upvoted comments

Hi @DoDoENT

Thanks for your report.

I am trying to reproduce, I have done a unit test replicating your scenario above in https://github.com/conan-io/conan/pull/17165, but it seems to be working fine. Could you please have a look and check what could be missing in the test? Thanks.