loud-laptop-89838
12/08/2022, 1:04 PMconftext file that has from delta import configure_spark_with_delta_pip, That package is actually delta-spark. When I run ./pants dependencies tests/conftest that dependency isn't inferred. So in tests/BUILD I added
python_requirement(
name="delta",
requirements=["delta-spark==2.2.0"]
)
But when I run the dependency check again, delta still isn't there. Am I putting the requirement in the wrong place?refined-addition-53644
12/08/2022, 1:08 PMpython_test_utils which just a wrapper over python_sources
https://www.pantsbuild.org/docs/reference-python_test_utilsrefined-addition-53644
12/08/2022, 1:13 PMpython_test_utilsbitter-ability-32190
12/08/2022, 1:14 PMmodule_mapper fields of the requirement targets, they map package names to module names (if they aren't the same)bitter-ability-32190
12/08/2022, 1:15 PMdelta module comes from the delta-spark packagerefined-addition-53644
12/08/2022, 1:16 PMloud-laptop-89838
12/08/2022, 1:19 PMdelta-spark as a dependency as @refined-addition-53644 mentioned. But would it work better if I used the module mapper?loud-laptop-89838
12/08/2022, 1:25 PMloud-laptop-89838
12/08/2022, 1:27 PM.env file, this would be a dependency that I have to add to the python_tests target under dependencies? If so, how do you identify those types of files that are stored in the project rootrefined-addition-53644
12/08/2022, 3:34 PMenv and then provide explicit dependencies to your python_tests
https://www.pantsbuild.org/docs/reference-files
Further if you need to put them somewhere where dotenv expects them to be you can use relocated_files
https://www.pantsbuild.org/docs/assets#relocated_filesloud-laptop-89838
12/08/2022, 6:44 PMfiles target at my root as
files(
name="dotenv",
sources=[".env"],
)
Then in the tests folder that I am running say tests/module/ I added the following to the BUILD file:
python_tests(
name="tests",
dependencies=[":relocated_dotenv"]
)
relocated_files(
name="relocated_dotenv",
files_targets=["//:dotenv"],
src="",
dest="tests/module"
)
But still facing the issue that the file is not being used in the test. Is there any way to see how those files are being created in the pex file? to see where the dotenv file appears? Or do you see anything wrong with what I've done?