wonderful-iron-54019
09/23/2020, 5:05 PMpython_library
/`python_tests` get resolved as we move our tests to v2 seeing an interesting issue when bringing in our common test utilswonderful-iron-54019
09/23/2020, 5:07 PMsrc/
testing/
watch/
common/
watch_join_subscription/
BUILD
wonderful-iron-54019
09/23/2020, 5:08 PMwonderful-iron-54019
09/23/2020, 5:10 PMwonderful-iron-54019
09/23/2020, 5:12 PMwonderful-iron-54019
09/23/2020, 5:13 PMintegration
and end_2_end
folders are part of src/testing
but they are promoted to the root unlike the other lib dependencies that get their own directorieswonderful-iron-54019
09/23/2020, 5:14 PMfrom testing.dataframe_test_case import DataframeTestCase
E ModuleNotFoundError: No module named 'testing'
wonderful-iron-54019
09/23/2020, 5:14 PMhundreds-father-404
09/23/2020, 5:15 PM[source].root_patterns
by chance in pants.toml
?wonderful-iron-54019
09/23/2020, 5:16 PM[source]
root_patterns = [
'src',
'build-support/plugins'
]
hundreds-father-404
09/23/2020, 5:17 PM/
(top-level). Thanks for confirmingwonderful-iron-54019
09/23/2020, 5:18 PMsetup_py
fieldwonderful-iron-54019
09/23/2020, 5:18 PMhundreds-father-404
09/23/2020, 5:20 PMone thig is that our testing bundle is the rare. python library with out a setup_py fieldThat’s totally fine. Most of our
python_library
targets internally don’t have a provides=setup_py
field. And in fact, in 2.0, we made a distinct python_distribution
target specifically for setup-py
.
It sounds like a common misconception is that python_library
corresponds to something you export to end users, e.g. the whole package. It can be that, but it need not be. It’s really any code that is source code, even if purely internal and never packaged.
It’s probably too late in the game for us to change this, but I wonder if python_sources
might have been a clearer name than python_library
.wonderful-iron-54019
09/23/2020, 5:21 PMsrc/testing
used to be testing
and i added it to the source root before deciding to move it into src
i forgot to save my pants.toml 🙈hundreds-father-404
09/23/2020, 5:23 PMpython_library
vs jvm_library
vs resources
etc. It always strips the source root. (Or, more recently, sets PYTHONPATH to avoid stripping so that you keep the full filename in the tool’s output)
The only exception is a files()
target. That always preserves its source roots.wonderful-iron-54019
09/23/2020, 5:23 PMwonderful-iron-54019
09/23/2020, 5:23 PMhundreds-father-404
09/23/2020, 5:25 PMwonderful-iron-54019
09/23/2020, 5:27 PMhundreds-father-404
09/23/2020, 5:28 PM[python-setup].resolver_jobs
. We set it to a sensible default in 2.0, but didn’t in 1.30 because you want a higher number if you’re using the v1 engine, but lower if using the v2 enginewonderful-iron-54019
09/23/2020, 5:29 PMwonderful-iron-54019
09/23/2020, 5:29 PMwonderful-iron-54019
09/23/2020, 5:30 PMhundreds-father-404
09/23/2020, 5:30 PMwonderful-iron-54019
09/23/2020, 5:31 PMwonderful-iron-54019
09/23/2020, 5:35 PMwonderful-iron-54019
09/23/2020, 5:36 PMENV1=val1 ENV2=val2 ./pants test <targets>
wonderful-iron-54019
09/23/2020, 5:36 PMhundreds-father-404
09/23/2020, 5:37 PMwonderful-iron-54019
09/23/2020, 5:37 PMwonderful-iron-54019
09/23/2020, 5:41 PMwonderful-iron-54019
09/23/2020, 5:42 PMhundreds-father-404
09/23/2020, 5:43 PMhundreds-breakfast-49010
09/23/2020, 5:50 PMwonderful-iron-54019
09/23/2020, 5:50 PMOBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES \
SPARK_MASTER=local[1] \
TZ=UTC \
ENV=dev \
DATA_BUCKET=test-bucket \
EXTERNAL_DATA_BUCKET=external-bucket \
./pants --no-v1 test ${PANTS_TARGETS} \
--pytest-args="${FILTER_OPTION} ${MARKS_OPTION}"
wonderful-iron-54019
09/23/2020, 5:51 PMhundreds-father-404
09/23/2020, 5:53 PMwonderful-iron-54019
09/23/2020, 5:53 PMwonderful-iron-54019
09/23/2020, 5:53 PMwonderful-iron-54019
09/23/2020, 5:54 PMwonderful-iron-54019
09/23/2020, 5:54 PMwonderful-iron-54019
09/23/2020, 5:54 PMhundreds-breakfast-49010
09/23/2020, 5:55 PMwonderful-iron-54019
09/23/2020, 5:55 PMhundreds-father-404
09/23/2020, 5:55 PMhundreds-breakfast-49010
09/23/2020, 5:56 PM--test-extra-env-vars
that lets you explicitly specify what environment variables you want to use in the testwonderful-iron-54019
09/23/2020, 5:56 PMhundreds-breakfast-49010
09/23/2020, 5:56 PM--test-extra-env-vars='[TZ=UTC, ENV=dev]'
, etc.hundreds-father-404
09/23/2020, 5:57 PMwill i need to pass the envvars. a different way?See https://www.pantsbuild.org/docs/python-test-goal#setting-environment-variables You could either use an allowlist approach, or you could haradcode them in
<http://pants.ci|pants.ci>.toml
rather than having them set in the scriptwonderful-iron-54019
09/23/2020, 5:57 PMwonderful-iron-54019
09/23/2020, 5:57 PMtoml
pathhundreds-breakfast-49010
09/23/2020, 5:57 PMhundreds-father-404
09/23/2020, 5:57 PMand will. that move over to the backport?Yep. The backport is to add that subsection I linked to “Setting environment variables”, with the nuance about Pantsd caching not working how we’d want for this feature.
wonderful-iron-54019
09/23/2020, 5:57 PMwonderful-iron-54019
09/23/2020, 5:58 PMwonderful-iron-54019
09/23/2020, 5:58 PMhundreds-father-404
09/23/2020, 6:02 PMhundreds-father-404
09/23/2020, 6:47 PMwonderful-iron-54019
09/23/2020, 6:48 PMhundreds-father-404
09/23/2020, 7:13 PMwonderful-iron-54019
09/23/2020, 7:15 PMhundreds-father-404
09/23/2020, 10:05 PMhundreds-father-404
09/24/2020, 4:19 AMwonderful-iron-54019
09/24/2020, 1:46 PM