chilly-tailor-75063
11/08/2022, 8:19 PMextra_requirements so I can get pytest to use the requests module with something like this extra-requirements=["requests==2.28.1"] in my pants.toml file. But that doesn’t address the problem that the request module isn’t found when I write the test. :(
What is the syntax and where does it go?witty-crayon-22786
11/08/2022, 8:21 PMwitty-crayon-22786
11/08/2022, 8:23 PMpytest in particular that you need requests, the goal is for Pants to infer that a particular file that has an import requests needs requests.witty-crayon-22786
11/08/2022, 8:24 PM./pants tailor, you see a bunch of warnings about failures to infer deps, those will be very important to fix.chilly-tailor-75063
11/08/2022, 8:26 PMpolite-garden-50641
11/08/2022, 8:27 PMextra-requirements is more for stuff like pytest plugins, for example, in our repo it looks like this:
[pytest]
version = "pytest==7.2.0"
extra_requirements.add = [
"pygments>=2.13.0",
"pytest-icdiff"
]chilly-tailor-75063
11/08/2022, 8:27 PMproject and tests are siblings, how do I inform test code how to import modules from the project folder?polite-garden-50641
11/08/2022, 8:27 PM.addpolite-garden-50641
11/08/2022, 8:27 PMchilly-tailor-75063
11/08/2022, 8:28 PMpants.toml file (not pyproject.toml)?polite-garden-50641
11/08/2022, 8:28 PMpolite-garden-50641
11/08/2022, 8:28 PMhappy-kitchen-89482
11/08/2022, 10:07 PMMaybe you can help me with something else. If I’ve got a directory structure where project and tests are siblings, how do I inform test code how to import modules from the project folder?The key concept is source roots. As long as those are configured, Pants will be able to find and knit together imports without you having to do anything special
happy-kitchen-89482
11/08/2022, 10:08 PM