Pytest - file not found

Hi there, I am just starting the python track and unfortunately I cannot run the tests. I have a virtual environment activated with pyenv and I seem to have pytest installed correctly:

python -m pytest --version
pytest 7.2.1

I seem to have the correct files:

(python-exercism) jorge@mac hello-world % ls -la
...
-rw-r--r--  1 jirka  staff  5907 Feb 28 13:03 HELP.md
-rw-r--r--  1 jirka  staff  1053 Feb 28 13:03 README.md
-rw-r--r--@ 1 jirka  staff    40 Feb 28 13:13 hello_world.py
-rw-r--r--  1 jirka  staff   294 Feb 28 13:03 hello_world_test.py

but the command python -m pytest -o markers=task {hello_world_test.py} gives:

========================================================================================== test session starts ===========================================================================================
platform darwin -- Python 3.11.0, pytest-7.2.1, pluggy-1.0.0
rootdir: /Users/jirka/Exercism/python/hello-world
collected 0 items                                                                                                                                                                                        

========================================================================================= no tests ran in 0.00s ==========================================================================================
ERROR: file or directory not found: {./hello_world_test.py}

Do you have any idea of what is happening here? Thanks :slight_smile:

You probably want:

python -m pytest -o markers=task hello_world_test.py

(no {} around the file name)

But usually you can omit the file name and pytest is able to find the tests for you. Assuming you are already on the exercise folder:

python -m pytest -o markers=task
1 Like

You should be able to also simply run pytest without anything else!

@andrerfcsantos @IsaacG You are both right, thank you! I did not realize that the curly braces are effectively acting as a placeholder for the actual filename at hand. Thank you.

2 Likes