happy-kitchen-89482
03/10/2021, 5:53 PMhigh-egg-2153
03/10/2021, 9:03 PMaverage-australia-85137
03/11/2021, 7:43 PMProcess
?average-australia-85137
03/11/2021, 7:58 PMechoing-farmer-15630
03/11/2021, 8:01 PMmylib/
requirements.txt
BUILD
mylib/
python source files...
BUILD
tests/
python test files with lots of 'from mylib import...'
BUILD
mylib/BUILD
just has a python_requirements
target to build the requirements in requirements.txt.
mylib/mylib/BUILD
just has a python_library
target with sources=["**.py", "/***.*py"]
, and
mylib/tests/BUILD
has a python_tests
target with sources=["***/*.py"]
and dependencies=['//mylib/mylib']
.
But when I do .pants test mylib/tests
, it looks like it resolves third-party requirements (and first-party; no complaints until pytest starts), but all of the from mylib import ...
statements get me cannot import name XXX from mylib (unknown location)
. So there's something I'm missing in how dependencies are resolved or copied or some such.
Doing pants dependencies mylib/tests
gets me entries like mylib/mylib/submodule/__init__.py:../../mylib
, if that helps at all.
I feel like I'm missing somethang that's just stonking obvious, but I'm not clever enough to diagnose it, it seems.user
03/11/2021, 9:56 PMuser
03/11/2021, 11:01 PMbored-art-40741
03/12/2021, 12:11 AMimportant-policeman-13818
03/12/2021, 7:51 AMbored-art-40741
03/13/2021, 7:29 PMbored-art-40741
03/13/2021, 7:29 PM./pants
Building native engine
error: failed to download from `<https://crates.io/api/v1/crates/adler/0.2.3/download>`
Caused by:
[77] Problem with the SSL CA cert (path? access rights?) (error setting certificate verify locations:
CAfile: /usr/lib/ssl/certs/ca-certificates.crt
CApath: /usr/lib/ssl/certs)
Failed to build native engine.
bored-art-40741
03/13/2021, 7:29 PMaverage-australia-85137
03/15/2021, 1:28 PMhappy-kitchen-89482
03/15/2021, 10:25 PMhappy-kitchen-89482
03/16/2021, 12:19 AMuse_pantsd=True
, even if hermetic=True
?many-agent-62725
03/16/2021, 2:20 PMpython_tests
has the property `coverage`:
coverage: A list of the module(s) you expect for this test target to cover. Usually, Pants and pytest-cov can auto-discover this if your tests are located in the same folder as the python_library code, but this is useful if the tests are not collocated.
However, in version 2.X, I noticed there’s no such property. What’s the equivalent one in Pants 2.X?nutritious-hair-72580
03/17/2021, 10:49 AMpython_library()
is required for tests to do imports (relative in my case). I only picked this up by looking at the example-python repo.
Say i have
• project1
• project2
◦ some-nesting
▪︎ greet
• greeting_test.py
• greeting.py
• BUILD
Then to do import Greeting from .greeting
in the test file, i need to both have the source root as /project2/some-nesting
and in the build file
python_library()
python_test(name="greet")
Reading the docs (https://www.pantsbuild.org/docs/python-test-goal), I got the impression that python_library was only required for test utils and/or binaries.happy-kitchen-89482
03/17/2021, 6:28 PMbrash-baker-91190
03/17/2021, 7:11 PMpants
script be located in the root of a repository, or is that just a convention? Would anything break horribly if we were to move it into, say, a bin
directory in the repo?user
03/19/2021, 1:42 AMwitty-crayon-22786
03/19/2021, 3:18 AMbusy-vase-39202
03/19/2021, 5:16 AMbusy-vase-39202
03/19/2021, 5:26 AMhappy-kitchen-89482
03/19/2021, 5:42 AMhappy-kitchen-89482
03/19/2021, 5:43 AMuser
03/19/2021, 3:46 PMtailor
- an exciting new features that generates BUILD file metadata for you, making adopting Pants easier than ever!
https://t.co/4I8vdkpcxe
Twitterhundreds-father-404
03/19/2021, 11:04 PMbored-art-40741
03/21/2021, 9:13 PMsrc/python/pants/backend/experimental/jvm/goals/repl.py:9:1: error: Module
'pants.backend.experimental.jvm.goals.coursier_resolve' does not explicitly
export attribute 'MavenRequirementsField'; implicit reexport disabled
[attr-defined]
from pants.backend.experimental.jvm.goals.coursier_resolve import (
^
bored-art-40741
03/21/2021, 9:14 PMbored-art-40741
03/21/2021, 9:15 PM