wooden-thailand-8386
09/22/2020, 6:41 PM============== test session starts ===============
platform darwin -- Python 3.7.8, pytest-5.3.5, py-1.9.0, pluggy-0.13.1
cachedir: .pants.d/test/pytest/.pytest_cache
rootdir: /Users/lzfnyy/Projects/clueless, inifile: /dev/null
plugins: cov-2.8.1, sanic-1.6.1, timeout-1.3.4
hundreds-father-404
09/22/2020, 6:54 PMtimeout=120
(in seconds) to the python_tests()
target
https://www.pantsbuild.org/docs/python-test-goal#using-timeoutswooden-thailand-8386
09/22/2020, 7:07 PMhundreds-father-404
09/22/2020, 7:09 PMwooden-thailand-8386
09/22/2020, 8:04 PMpandas
it started throwing a couple of odd warnings here and there.. same for Tensorflow.. I just wanted to make sure that pants
wasnt really causing anything before diving inhundreds-father-404
09/22/2020, 8:08 PMtop
, to see if the CPU is in active usehundreds-father-404
09/22/2020, 8:09 PMwooden-thailand-8386
09/22/2020, 8:25 PMpytest tests
so Iām almost sure that pants
isnt the culprit but Iāll update you guys on this matterhundreds-father-404
09/22/2020, 8:31 PMwooden-thailand-8386
09/23/2020, 8:35 PMpants.toml
. I have a couple of tests that are dependent of pytest-sanic
but everything else isnāt.hundreds-father-404
09/23/2020, 8:39 PMpython_tests
targets.
See https://www.pantsbuild.org/docs/python-third-party-dependencies#defining-inline-requirements for how to define those requirements inline, if you donāt want them to be in a global requirements.txt
.
Then, add the targets to the dependencies
field. Note that dep inference wonāt ever be able to infer the deps, as they arenāt used in import statements.
This is how we load pytest-django
in Toolchainās repowooden-thailand-8386
09/23/2020, 8:41 PMhundreds-father-404
09/23/2020, 8:42 PMwooden-thailand-8386
09/23/2020, 8:43 PMhundreds-father-404
09/23/2020, 8:45 PMpython_library()
python_tests(name='tests')
A more complex example
python_library()
python_tests(
name='tests',
dependencies = [
'3rdparty/python:pytest-django', # Test time requirement.
'src/python/toolchain/buildsense', # Used in `conftest.py`.
...
],
)
wooden-thailand-8386
09/23/2020, 8:47 PMpython_library()
and I have a couple but Iām not sure what theyāre doing šhundreds-father-404
09/23/2020, 8:48 PMhundreds-father-404
09/23/2020, 8:49 PMcompatibility
for Python interpreter versions
Btw, ./pants dependencies path/to/file.py
is helpful to see what Pants is inferring.wooden-thailand-8386
09/23/2020, 8:55 PMwooden-thailand-8386
09/23/2020, 8:56 PMhundreds-father-404
09/23/2020, 8:59 PMsorry about asking these silly questions,Not at all silly. We made some pretty fundamental changes to how you interact with Pants in 2.0, with a) dependency inference and b) āfile-level addressesā that allow you to operate with file-level precision, e.g. depend on just a file (https://www.pantsbuild.org/docs/how-to-upgrade-pants-2-0#files-are-now-the-atomic-unit-rather-than-targets-130-vs-20) It took us about 2-3 months of iterating on different designs. Definitely not silly or trivial with questions like that
hundreds-father-404
09/24/2020, 3:59 PM