Unit testing Python code using Pytest + GitHub Actions

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ย. 2024
  • Get started using Notion Projects for free, and unlock the power of AI for only $10 a month: ntn.so/carberra
    -
    Testing your code is essential, especially when it going to be used by the public. Testing it locally however is not enough, and setting up a CI pipeline can help identify and fix errors you may have missed. Pytest and GitHub Actions allow you to do just that, which will save you from endless compaints from the people who broken your application in less than 5 minutes. Because of course they did.
    -
    If you enjoy my content, consider supporting me on Patreon or becoming a member!
    patreon.carber...
    join.carberra.xyz
    If you need help with anything, feel free to join the Discord server:
    discord.carber...
    I get a lot of people asking, so here's my Visual Studio Code setup!
    • My Visual Studio Code ...
    -
    If you have any questions, don't hesitate to ask in the comments! I'll try and answer as soon as I can, providing someone else hasn't already done so.
    #python #coding #howto

ความคิดเห็น • 22

  • @abdocharrade1811
    @abdocharrade1811 21 วันที่ผ่านมา

    Very cool video. Immediately subscribed the channel and liked your video. Totally forgot how satisfying it is to listen to a tutorial without thinking in parallel what tutor is saying... :D :D

    • @Carberra
      @Carberra  21 วันที่ผ่านมา

      Thanks man, I appreciate it!

  • @pastnowisaac7997
    @pastnowisaac7997 หลายเดือนก่อน

    Simple and good, thanks!

  • @ABDULRASHEED-e3h
    @ABDULRASHEED-e3h 10 หลายเดือนก่อน

    Explained well. Thanks Bro 💕

  • @skywalker4279
    @skywalker4279 10 หลายเดือนก่อน

    Beautiful terminal interface. Is that ohmyzsh? Do you have a video on how you setup your shell?

    • @Carberra
      @Carberra  10 หลายเดือนก่อน

      Funnily enough, I do! th-cam.com/video/4RuGK3w6Mbs/w-d-xo.htmlsi=bBqQtha_PiDiU7M_

  • @shankubisai1370
    @shankubisai1370 หลายเดือนก่อน

    That was a great explanation. I can see that this a private repo. Could you please share the source code in a public repo.Thanks..!!

  • @fish42
    @fish42 6 หลายเดือนก่อน

    How did you decide which Python versions to include in your testing?

    • @Carberra
      @Carberra  6 หลายเดือนก่อน +1

      The ones I used here were the ones officially supported by Python at the time. 3.7 has since reached end of life, so you perhaps don't need to support that anymore, but you'd just include any versions here you support in your project.

  • @tonibest7965
    @tonibest7965 ปีที่แล้ว +1

    User: This app doesn work !
    Coder: "It works on my computer"

  • @ronaldfungss
    @ronaldfungss ปีที่แล้ว

    Nice and neat. Thanks a lot!

  • @kevinoudelet
    @kevinoudelet 6 หลายเดือนก่อน +1

    thx

  • @sharjeel_mazhar
    @sharjeel_mazhar 6 หลายเดือนก่อน

    how did you get that sourcery code metrics pop up at time 9:17

    • @Carberra
      @Carberra  6 หลายเดือนก่อน

      It's an extension, but I don't think the free version has that feature anymore.

    • @sharjeel_mazhar
      @sharjeel_mazhar 6 หลายเดือนก่อน

      @@Carberra can you tell me it's name? And by the way, your tutorial really saved a lot of my time. I used ChatGPT to make pytest and other yaml workflow and it really backfired. You are a savior!

    • @Carberra
      @Carberra  6 หลายเดือนก่อน

      TH-cam didn't notify me of this -- glad I could help! The extension is called Sourcery as far as I remember, but I don't think I have it enabled anymore. Maybe the code quality stuff still works.

  • @shanmugamudhaya7726
    @shanmugamudhaya7726 ปีที่แล้ว

    what happens if you fail? does it prevent you from pushing

    • @Carberra
      @Carberra  ปีที่แล้ว +1

      Only if you set it as a pre-commit hook.

    • @sharjeel_mazhar
      @sharjeel_mazhar 6 หลายเดือนก่อน

      @@Carberra how to do that? lets say if i want to make sure that my python code is only pushed to the main/master branch if it passes the tests. Otherwise it shouldn't push.

  • @HobbiesInterests
    @HobbiesInterests 6 หลายเดือนก่อน

    short and to the point. I can see why Jenkins and other ci tools will likely go extinct.

  • @markmccarthy1486
    @markmccarthy1486 ปีที่แล้ว +1

    "promo sm"

  • @temp911Luke
    @temp911Luke ปีที่แล้ว +2

    User: This app doesn work !
    Coder: "It works on my computer"