CyanBook
CyanBook

Reputation: 136

How to use pytest correctly

I'm building my first python package. I noticed an automatic test of the code made directly into GitHub by pytest I surfed for good and clear explanations but I can't figure out myself Is there any way you can help me?

The dir structure:

-> deezepy:
       |
       -> __init__.py
       -> client.py
       -> types.py

-> tests/
       currently empty

what should I put in my test directory? the two files:

client.py -> https://hastebin.com/yoyemirula.py

types.py -> https://hastebin.com/amafegilic.rb

I'm very glad about anybody that can help me using these tools for the first time, thanks!

Upvotes: 1

Views: 63

Answers (1)

VonC
VonC

Reputation: 1324937

If you want pytest to run on each git push, you should consider a GitHub Action like: Python Pytest GitHub Action.

Follow "Automate Python Testing With GitHub Actions" from Rupert Thomas for a more manual example (he does not use that action, but explicitely all the steps required to run pytest on your code).

https://miro.medium.com/max/1400/1*mgJ8S_Chqt755Aw5MSSHaw.jpeg

Upvotes: 1

Related Questions