1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to pass arguments in pytest by command line

Discussão em 'Python' iniciado por Stack, Novembro 24, 2025.

  1. Stack

    Stack Membro Participativo

    I have a code and I need to pass the arguments like name from terminal. Here is my code and how to pass the arguments. I am getting a "File not found" kind error that I don't understand.

    I have tried the command in the terminal: pytest <filename>.py -almonds I should get the name printed as "almonds"

    @pytest.mark.parametrize("name")
    def print_name(name):
    print ("Displaying name: %s" % name)

    Continue reading...

Compartilhe esta Página