on MacOS, I want to run pytest in command line:
python3 -m pytest test_function_validation.py
However, test_function_validation.py has got argparser in it written as:
import pytest
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('-f', action='store', nargs=1, dest='file_to_read')
args = parser.parse_args()
file_to_read = args.file_to_read[0]
...etc
Question: I was running
python3 -m pytest test_function_validation.py -f input_data.json
And it complains:
pytest.py: error: unrecognized arguments: -f input_data.json
I also tried:
pytest test_function_validation.py -f input_data.json
which result in error:
-bash: /usr/local/bin/pytest: /usr/local/opt/python/bin/python3.6: bad interpreter: No such file or directory
So, how can run a pytest with some arguments passed into the test file . I need to do this in command line in terminal.