0

I manually run my pytest as following:

$ pytest test_a.py --opt0="123 456" --opt1="789 abc"

In YAML file .gitlab-ci, I woud like to define something similar:

test_a:
  scripts:
    - pytest test_a.py ${OPTIONS}
  variables:
    OPTIONS: --opt0="123 456" --opt1="789 abc"

It turns out that the value of opt0 is 123 456 --opt1="789 abc"

Do you have any idea of what happens and how to pass the arguments correctly?

Thank you in advance.

1 Answers1

0

It's a very minor issue, all you need to do is surround your OPTIONS value with single quote.

Also maybe it is a typo, but it should be just script whereas in your snippet it is scripts. :)

test_a:
  script:
    - pytest test_a.py ${OPTIONS}
  variables:
    OPTIONS: '--opt0="123 456" --opt1="789 abc"'

I tried it with echoing the script command.

enter image description here

Abid Khan
  • 145
  • 2
  • 9