1

I've been looking all over the internet for an answer. They all tell me to make sure I do exactly what you can see I did below. I'm actually making this all during an online class in Pytest and it just doesn't work.

ls TestCheckout.py __init__.py __pycache__ pytest.ini cat TestCheckout.py def test_ConInstantiateCheckout(): co = CheckOut() pytest =================================================== test session starts ==================================================== platform darwin -- Python 3.7.4, pytest-5.2.0, py-1.8.0, pluggy-0.13.0 rootdir: /Users/ddow/dev/supermarket-kata collected 0 items ================================================== no tests ran in 0.01s 

Does anyone know what gives? Any help would be greatly appreciated.

1 Answer 1

7

pytest follows a test discovery procedure. You can check the details here.

For your particular case, the file name should start with test_ or end with _test.py. So renaming TestCheckout.py to test_Checkout.py would work. In case, you do not wish to change the name, you could provide the filename explicitly as in

user@qt01:~/folder$ pytest TestCheckout.py ============================================== test session starts ============================================== platform linux -- Python 3.5.2, pytest-5.1.2, py-1.8.0, pluggy-0.12.0 sensitiveurl: .* rootdir: /home/user/folder plugins: needle-0.3.11, selenium-1.17.0, html-1.21.1, repeat-0.8.0, metadata-1.8.0, celery-4.3.0, base-url-1.4.1, variables-1.7.1 collected 1 item TestCheckout.py . [100%] =============================================== 1 passed in 0.03s =============================================== user@qt01:~/folder$ 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.