0

I need to pass the path to 2 files using command line arguments in a pytest.

I have looked into many answers but they all require modifying conftest.py How to pass arguments in pytest by command line

Is there anyway to add arguments that can be used in a test script without modifying conftest.py?

Ideally, I would like to do this within the test file but it's not necessarily required. I have tried to import argparse in the test file to add the additional arguments but it didn't work

Evan Brittain
  • 547
  • 5
  • 15

1 Answers1

0

pytest hooks, including pytest_addoption must be defined in either a plugin or a conftest.py file

see also:


disclaimer: I'm a pytest core dev

anthony sottile
  • 61,815
  • 15
  • 148
  • 207