mamba-org/boa

Test fails when build section has include_recipe: False

frmdstryr opened this issue · 2 comments

When building a recipe with include_recipe: False in the build section (as shown here https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#include-build-recipe) the build fails when it attempts to run the test.

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│                                                                                                  │
│ /home/user/projects/boa/boa/core/run_build.py:390 in build_recipe                                 │
│                                                                                                  │
│   387 │   │   │   if final_outputs is not None:                                                  │
│   388 │   │   │   │   for final_out in final_outputs:                                            │
│   389 │   │   │   │   │   if not notest:                                                         │
│ ❱ 390 │   │   │   │   │   │   run_test(                                                          │
│   391 │   │   │   │   │   │   │   final_out,                                                     │
│   392 │   │   │   │   │   │   │   o.config,                                                      │
│   393 │   │   │   │   │   │   │   stats,                                                         │
│ /home/user/projects/boa/boa/core/test.py:673 in run_test                                          │
│                                                                                                  │
│   670 │   │   metadata = recipedir_or_package_or_metadata                                        │
│   671 │   │   utils.rm_rf(metadata.config.test_dir)                                              │
│   672 │   else:                                                                                  │
│ ❱ 673 │   │   metadata, hash_input = construct_metadata_for_test(                                │
│   674 │   │   │   recipedir_or_package_or_metadata, config                                       │
│   675 │   │   )                                                                                  │
│   676                                                                                            │
│                                                                                                  │
│ /home/user/projects/boa/boa/core/test.py:356 in construct_metadata_for_test                       │
│                                                                                                  │
│   353 │   │   #     recipedir_or_package, config                                                 │
│   354 │   │   # )                                                                                │
│   355 │   else:                                                                                  │
│ ❱ 356 │   │   m, hash_input = _construct_metadata_for_test_from_package(                         │
│   357 │   │   │   recipedir_or_package, config                                                   │
│   358 │   │   )                                                                                  │
│   359 │   return m, hash_input                                                                   │
│                                                                                                  │
│ /home/user/projects/boa/boa/core/test.py:307 in _construct_metadata_for_test_from_package         │
│                                                                                                  │
│   304 │   │   #     os.path.join(info_dir, "recipe"), config=config, reset_build_id=False        │
│   305 │   │   # )[0][0]                                                                          │
│   306 │   │                                                                                      │
│ ❱ 307 │   │   metadata = get_metadata(os.path.join(info_dir, "recipe", "recipe.yaml"), config)   │
│   308 │   │   # with open(os.path.join(info_dir, "recipe", "recipe.yaml")) as fi:                │
│   309 │   │   # metadata = yaml.load(fi)                                                         │
│   310 │   # no recipe in package.  Fudge metadata                                                │
│                                                                                                  │
│ /home/user/projects/boa/boa/core/test.py:54 in get_metadata                                       │
│                                                                                                  │
│    51                                                                                            │
│    52                                                                                            │
│    53 def get_metadata(yml, config):                                                             │
│ ❱  54 │   with open(yml, "r") as fi:                                                             │
│    55 │   │   d = ruamel.yaml.safe_load(fi)                                                      │
│    56 │   o = Output(d, config)                                                                  │
│    57 │   return MetaData(os.path.dirname(yml), o)                                               │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/tmpcswq3wbj/info/recipe/recipe.yaml'

I tried adding FileNotFoundError to the except but then it failed with AttributeError: type object 'MetaData' has no attribute 'fromdict'

Thanks!