<#21701 Referencing metadata in a pants test (pyte...
# github-notifications
c
#21701 Referencing metadata in a pants test (pytest) New discussion created by kdowney-talos Running this code in a unit test with load_metadata("serenity-base"): import importlib.metadata as meta def load_metadata(package_name: str): return meta.metadata(package_name) fails with:
Copy code
E           importlib.metadata.PackageNotFoundError: No package metadata was found for serenity-base
but only when I run via `pants test`; it passes when I just run pytest standalone. I believe this is because pytest is picking up the egg-info directory in the main source folder, which has the relevant metadata from the `pyproject.toml`: in this case, that the package name is
serenity-base
for distribution purposes. Is there any way to get pants test to do the same? pantsbuild/pants