Code Monkey home page Code Monkey logo

Comments (8)

bubenkoff avatar bubenkoff commented on May 29, 2024
I cannot see where the "Some\nExtra\nLines" is coming from. Probably the 
assertion needs to be fixed / enhanced to handle / compare the indentation.

it comes from the given, because like any given it's fixture which you can access later in other given, when, then functions

from pytest-bdd.

bubenkoff avatar bubenkoff commented on May 29, 2024

about the rename i totally agree and will do

from pytest-bdd.

blueyed avatar blueyed commented on May 29, 2024

it comes from the given

Ah, I see. Missed that.
But then the text argument is invalid here maybe?
I see that i_have_text comes from the when, but not where text is coming from.

from pytest-bdd.

bubenkoff avatar bubenkoff commented on May 29, 2024

text is coming from the step text as a step argument
It's probably a bit too complicated example

from pytest-bdd.

bubenkoff avatar bubenkoff commented on May 29, 2024
@given(re.compile(r'I have a step with:\n(?P<text>.+)', re.DOTALL))
def i_have_text(text):
    return text

this is an argumented step so it's function gets an argument 'text' because it's a regex group name
cool that you've pointed out this place - because it uses an outdated way of declaring argumented steps

from pytest-bdd.

blueyed avatar blueyed commented on May 29, 2024

So this means that any step arguments are available in the then automatically / when requested?

I would have expected that only fixtures (and pytest-bdd's extension of them) could be requested/used as arguments.

Anyway, it would certainly benefit from some explanation.. :)

from pytest-bdd.

bubenkoff avatar bubenkoff commented on May 29, 2024

any step argument is injected into pytest's request as a normal fixture, no difference, so you access it in natural way. this allows you to 'mark.parametrize' your test with argumented given, without having to decorate the actual test! And if the name of the argument clashes with existing fixture name, it will override it - so very powerful and we use that quite a lot.
pytest-bdd is build on top of fixtures and only fixtures :)
yes, i'll add more to the step arguments section - about that fact that step arguments are fixtures as well.

from pytest-bdd.

blueyed avatar blueyed commented on May 29, 2024

Thanks!

Sounds very powerful indeed.

from pytest-bdd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.