DEV Community

Discussion on: Python TDD with Pytest -- Getting Started

Collapse
 
dmahely profile image
Doaa Mahely

Hey Kinyanjui. Thanks for this series.
I'm just getting started with pytest. I have a program that has multiple user inputs. I wrote 3 basic tests so far. All using if statements then asserts.
When I run pytest card.py -s, the program runs and I have to input all the data, then I get the message whether the tests have passed or not.
My question is, how can I run the tests without the code having to run? Does it depend on how I wrote the tests?

Collapse
 
wangonya profile image
Kelvin Wangonya

Hey @dmahely ! Thanks for reading, and I'm glad you liked it. Sorry for the late reply, it's been a while since I was here.

You can automate the tests by passing in mock data. Do you have the code hosted on GitHub or somewhere I can have a look so I can guide you on how to do it?

Collapse
 
dmahely profile image
Doaa Mahely

Is that what automated tests mean? 😅
The code was for a technical test that I've since submitted, and the instructions included not putting it on GitHub. May I reach out to you on Twitter?

Thread Thread
 
wangonya profile image
Kelvin Wangonya

Yeah, feel free to reach out on Twitter.