trying to add support for `.feature` files w/ pyte...
# plugins
a
trying to add support for
.feature
files w/ pytest-bdd in 2.11.x everything works as intended when we do
file(source='test.feature')
But when doing
Copy code
class GherkinSourceField(SingleSourceField):
  expected_file_extensions = (".feature",)

class GherkinSourceTarget(Target):
  alias = "gherkin_source"
  core_fields = (*COMMON_TARGET_FIELDS, GherkinSourceField,)
and changing
file
to
gherkin_source
it stops working, and the .feature file is no longer included. Feels like
file
and
gherkin_source
are functionally identical? Am I missing something?
1
f
You probably need to have that field inherit from
FileSourceField
.
I assume that
FileFieldSet
is what is used to see if something is a
file
target and it has a
FileSourceField
, so only that class or a subclass will match that
FieldSet
.
More interestingly,
FileSourceField
and
ResourceSourceField
both inherit from
AssetSourceField
, and there seems to be some rules like
_hydrate_asset_source
, so could some API in play that you could hook into.
a
that's in
main
in 2.11 it's different
i think hydrate asset source is some magic to allow fetching of files from http sources
coke 2
b
There's a very lengthy discussion surrounding dependency handling. For now, I'd suggest inheriting like Tom suggests
a
cheers.