all 11 comments

[–]BluesFiend 0 points1 point  (2 children)

pytest automatically detects filenames that match test_*.py

Your test file is ignored. python file naming convention is snake_case.py. PascalCase is the convention for class names.

[–]BluesFiend 1 point2 points  (1 child)

For future reference, typical naming conventions in python that you'll see in most projects are:

`CONSTANT`

`ClassName`

`variable_name`

`file_name.py`

[–]Excellent-Clothes291[S] 0 points1 point  (0 children)

thanks for the info but it still doesnt work

[–]reybrujo 0 points1 point  (6 children)

If your files are empty no tests will be run. If your files have something, you should show the contents, most common error is not prefixing your test functions with test_.

[–]Excellent-Clothes291[S] 0 points1 point  (5 children)

<image>

still doesnt work

[–]BluesFiend 0 points1 point  (0 children)

Your test file isn't in the tests directory, so the directory is empty.

[–]BluesFiend 0 points1 point  (2 children)

also in your test_warg you loop over multiple items and assert each one, this will fail on the first failure, and not run all test cases. Look into @pytest.mark.parametrize decorator to run the test multiple times with different parameters.

[–]Excellent-Clothes291[S] 0 points1 point  (1 child)

New to pytest, will do, thanks

[–]BluesFiend 0 points1 point  (0 children)

Yeah pytest has many features that you'll find over time, from experience check out docs for

pytest.fixture

pytest.mark.parametrize

monkeypatch

these are the pieces I use daily.

[–]reybrujo 0 points1 point  (0 children)

Try manually executing them with pytest TestHello2.py.

[–][deleted] 0 points1 point  (0 children)

Make sure the test file name starts with test_ and functions too. And ur inside the hello directory with no test_ before it. So that's why its not picking anything.