https://pantsbuild.org/ logo
c

crooked-lawyer-77407

04/03/2023, 4:00 AM
Has anyone had issues with
pants test
give a
Module not found error
to find their core module when using
import <core_module>
in the tests? We've had this issue for a while but have circumvented it by just running pytest directly in an exported environment, would be nice to not have to do that.
h

high-yak-85899

04/03/2023, 4:14 AM
What do you mean by core module?
c

crooked-lawyer-77407

04/03/2023, 4:18 AM
Sorry the actual root module of the package being built
Was just trying to indicate that there's no "import path" other than
import x
i.e. no
import x.y.z
It acts as though the package is not installed when running the tests
r

refined-addition-53644

04/03/2023, 9:45 AM
This has most probably to do something with how you define source roots
c

crooked-lawyer-77407

04/03/2023, 10:03 AM
Could this have anything to do with having namespace packages?
r

refined-addition-53644

04/03/2023, 11:29 AM
Yes I think that's the issue. Maybe post the repo structure you are using to figure out what's not aligned with the pants/python expectations.
6 Views