witty-crayon-22786
11/05/2018, 7:05 PMmysterious-farmer-45668
11/05/2018, 7:07 PMmysterious-farmer-45668
11/05/2018, 7:10 PMacoustic-book-58772
11/05/2018, 7:23 PM./pants clean
.
FAILURE: (u"Error resolving binary request BinaryRequest(supportdir=bin/watchman, version=4.9.0-pants1, name=watchman, platform_dependent=True, external_url_generator=None, archiver=None): Pants could not resolve binaries for the current host. Update --binaries-path-by-id to find binaries for the current host platform (u'darwin', u'18').\n--binaries-path-by-id was: {(u'darwin', u'11'): (u'mac', u'10.7'), (u'linux', u'amd64'): (u'linux', u'x86_64'), (u'darwin', u'9'): (u'mac', u'10.5'), (u'darwin', u'14'): (u'mac', u'10.10'), (u'darwin', u'17'): (u'mac', u'10.13'), (u'darwin', u'16'): (u'mac', u'10.12'), (u'darwin', u'10'): (u'mac', u'10.6'), (u'darwin', u'15'): (u'mac', u'10.11'), (u'linux', u'i686'): (u'linux', u'i386'), (u'linux', u'x86_64'): (u'linux', u'x86_64'), (u'darwin', u'13'): (u'mac', u'10.9'), (u'darwin', u'12'): (u'mac', u'10.8'), (u'linux', u'i386'): (u'linux', u'i386')}.", MissingMachineInfo(u"Pants could not resolve binaries for the current host. Update --binaries-path-by-id to find binaries for the current host platform (u'darwin', u'18').\n--binaries-path-by-id was: {(u'darwin', u'11'): (u'mac', u'10.7'), (u'linux', u'amd64'): (u'linux', u'x86_64'), (u'darwin', u'9'): (u'mac', u'10.5'), (u'darwin', u'14'): (u'mac', u'10.10'), (u'darwin', u'17'): (u'mac', u'10.13'), (u'darwin', u'16'): (u'mac', u'10.12'), (u'darwin', u'10'): (u'mac', u'10.6'), (u'darwin', u'15'): (u'mac', u'10.11'), (u'linux', u'i686'): (u'linux', u'i386'), (u'linux', u'x86_64'): (u'linux', u'x86_64'), (u'darwin', u'13'): (u'mac', u'10.9'), (u'darwin', u'12'): (u'mac', u'10.8'), (u'linux', u'i386'): (u'linux', u'i386')}.",))
11:17:52 00:01 [complete]
FAILURE
future-butcher-94831
11/05/2018, 7:37 PM1.11.0rc1
for https://github.com/pantsbuild/pants/pull/6591.witty-crayon-22786
11/05/2018, 7:37 PMacoustic-book-58772
11/05/2018, 7:40 PMfierce-park-88503
11/05/2018, 8:04 PM# my_fixtures.py
@pytest.fixture
def foo():
yield 'foo'
@pytest.fixture
def foobar(foo):
yield foo + 'bar'
from my_fixtures import foobar
def test_foobar(foobar):
assert foobar == 'foobar'
the foobar
fixture will fail to initialize because foo
isn’t in pytest’s search path for fixturesfierce-park-88503
11/05/2018, 8:06 PMfierce-park-88503
11/05/2018, 8:07 PMfrom my_fixtures import foobar, foo
def test_foobar(foobar):
assert foobar == 'foobar'
would also work I think, but it’s weird to make users of foobar
realize that it depend on foo
enough-analyst-54434
11/05/2018, 8:52 PMfoobar
fixture and the foo
fixture is in the same file, how is the one " in pytest’s search path for fixtures" and the other not?enough-analyst-54434
11/05/2018, 8:54 PMfrom my_fixtures import foobar, foo
in the test if the test only actually uses foobar
?enough-analyst-54434
11/05/2018, 8:54 PMfierce-park-88503
11/05/2018, 8:55 PMenough-analyst-54434
11/05/2018, 8:56 PMfierce-park-88503
11/05/2018, 8:56 PMenough-analyst-54434
11/05/2018, 8:56 PMfierce-park-88503
11/05/2018, 8:56 PMfoobar
fixture will fail to initialize because foo
isn’t in pytest’s search path for fixtures”enough-analyst-54434
11/05/2018, 9:01 PMenough-analyst-54434
11/05/2018, 9:02 PMenough-analyst-54434
11/05/2018, 9:08 PMenough-analyst-54434
11/05/2018, 9:08 PMfierce-park-88503
11/05/2018, 10:18 PMyield
could be a return
in this case I think. but it wouldn’t make it an iterator, pytest.fixture
does some context-managery stuff for you, so you can do like:
@pytest.fixture
def thingy():
# prepare a_thing
yield a_thing
# clean up a_thing
https://docs.pytest.org/en/latest/fixture.html#fixture-finalization-executing-teardown-codefierce-park-88503
11/05/2018, 10:21 PMfierce-park-88503
11/05/2018, 10:58 PMfierce-park-88503
11/05/2018, 10:59 PMfierce-park-88503
11/05/2018, 11:00 PMuser_of_the fixture
depend on lib_defining_the_fixture
depending on conftest.py
fierce-park-88503
11/05/2018, 11:01 PMfierce-park-88503
11/05/2018, 11:01 PMenough-analyst-54434
11/06/2018, 1:22 PMone solution would be to set up a conftest.py that declares all necessary fixtures. and this also can be made to work in pants, but will require that all tests that use these kinds of fixtures declare conftest.py as a dependencyThat makes the most sense to me. If you find it distasteful you could write a very small plugin that exposes a
conftests
target that comes with this dep automatically added and use that instead of python_tests
in your BUILD file(s).
This conversation was very confusing for me because it had little to do with pants and alot to do with pytest. Importing a fixture does not work - pants aside - if that fixture depends on another - even in the same file - unless you either a.) import it too (even though you don't use it) or b.) use conftest.py to register all your fixtures. I think the summary is that Pants can't help you today with the extras bogus imports technique in a.) and it forces you to make the implicit dependency on conftest.py to work its magic explicit for technique b.). I'm not sure how we'd make either better except to to ship a canned version of the conftests
plugin target described above. If you can think of a better idea it's probably worth an enhancement/idea issue to flesh it out.