Intro to Python Mocks | Python tutorial

Поділитися
Вставка
  • Опубліковано 30 вер 2024

КОМЕНТАРІ • 152

  • @vikrantmahajan142
    @vikrantmahajan142 Рік тому +15

    It's an amazing video! You have really broken the concepts into very easily understandable components. Loved your way of explanation! Thanks

  • @RedEyedCoderClub
    @RedEyedCoderClub  2 роки тому +4

    What video should I make next? Any suggestions? Write me in comments!
    Follow me @:
    Telegram: t.me/red_eyed_coder_club
    Twitter: twitter.com/CoderEyed
    Facebook: fb.me/redeyedcoderclub

  • @diwakardayalan
    @diwakardayalan Місяць тому

    No one in UA-cam was able to explain this mock with such a simple example. If I could request would you be able to make a series on testing AWS services using mock.

  • @aamirsuleman9815
    @aamirsuleman9815 18 днів тому

    Amazing work! Never thought of pronouncing OK as Awk.

  • @sergeyshevtsov5125
    @sergeyshevtsov5125 2 роки тому +8

    That's just what i needed right now. Oleg, thank you!
    Been watching your channel since 2017, some time supported on patreon, your content never disappoints. You make very clear and understandable explanation on every important nuance, incrementally from easy to advanced stuff. Sometimes I miss, when there are no new videos for a long time :) Big thank you anyway. I personally think that you made a huge, or even biggest contribution(not size, but in terms of quality, for sure) into instructional videos for Russian self-taught python developers, and now for International community. Time ago your videos helped me to learn a lot of things, to get a first paid developer job and etc.
    Legend!

  • @ygr4943
    @ygr4943 3 місяці тому +1

    شكرا ❤❤

  • @benjamintanchingjui6741
    @benjamintanchingjui6741 Рік тому +1

    I think the url no longer works for the jokes?

    • @RedEyedCoderClub
      @RedEyedCoderClub  Рік тому

      it's a pity, but you can use any other API or a website.

  • @Flowmastaz
    @Flowmastaz 11 місяців тому

    Your voice sounds exactly like Oleg Molchanov. Where are you from?

    • @Flowmastaz
      @Flowmastaz 11 місяців тому

      А, уже увидел, что это ты и есть) Класс, часто твои ролики на русском смотрю, теперь видать и на английском буду. Кстати, у тебя хороший английский. Долго учил?

    • @RedEyedCoderClub
      @RedEyedCoderClub  10 місяців тому

      Не знаю, трудно сказать. Думаю если бы занимался систематично и регулярно знал бы его значительно лучше.

  • @roberto_camp
    @roberto_camp 2 роки тому +3

    Fantastic tutorial. Took me from almost no knowlege of python unittest and mocks to very confident. Thank you!

  • @ОксанаХлопотина-ы9п

    Your work is excellent, you help me a lot, thank you!

  • @sagarhm2237
    @sagarhm2237 Рік тому

    sir how to write unit test for url loding , and websit proper loding

  • @LuisAlonsoLopezLopez
    @LuisAlonsoLopezLopez Рік тому

    Can you make a video but using Pytest please?

  • @eatttmore
    @eatttmore 7 місяців тому

    братишка лучше гайда не видел успехов тебе от души

  • @meabhgrogan
    @meabhgrogan 8 місяців тому

    This was so helpful thank you 🙏

  • @אופקדהן-ע5פ
    @אופקדהן-ע5פ 2 місяці тому

    Great tutorial! thank you for that

  • @kacperwodarczyk9349
    @kacperwodarczyk9349 Рік тому

    Finally I found great and not arabian tutorial

  • @subrinalazad3215
    @subrinalazad3215 2 роки тому

    Thanks for the video.
    I'm facing a error when running the test.py
    ModuleNotFoundError: No module named 'main'

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      Ok, have you the `main.py` module?
      What's you directory/files structure?
      Did you check your code twice?

  • @maxjokar7920
    @maxjokar7920 Рік тому

    Hello, or privet,
    Whatever, thanks ever so much for ur video. Ure superman 👍🏻🌹👍🏻

  • @williamgillett1756
    @williamgillett1756 Рік тому +1

    Excellent video - great examples - so simple, but complete, I agree with others that your commentary is incredible. You describe what is going on at every step - both in the code and in the underlying logic. Mocks can be confusing to me and you really help break down the concepts so thoroughly. This is my first experience watching videos by you. I will be back for more! PS - I usually use pytest, but it was helpful to see the more traditional unittest methodology applied to mocks. Translating your code to pytest was a good exercise for a newbie like me.

  • @evanliu6158
    @evanliu6158 Рік тому

    🎉 very nice explanation

  • @AlexeyLebedev-v8h
    @AlexeyLebedev-v8h Рік тому +1

    THATS what happened to your previous channel. Such a great surprise to occasionally find out that you are not done with youtube.
    Since me watching my first video on your channel many things happened, and even after all those years i can definitely say that your material is way beyond the others in terms of quality.
    Keep it up man

  • @abrikosa717
    @abrikosa717 2 роки тому +1

    Thank you for the guide. It's indeed very interesting and useful. Subscribed!

  • @ininim
    @ininim 2 роки тому +1

    Thanks you so much for this interesting and detailed guide. Will there be videos on testing with pytest?

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому +2

      Thank you! Yes, a planned to make videos about pytest. Stay tuned.

  • @Evilflesh666
    @Evilflesh666 2 роки тому

    Дай обниму братюнь, отличный видос, спасибо.

  • @Bholu420
    @Bholu420 3 місяці тому

    Nice tutorial

  • @JedLearns
    @JedLearns Місяць тому

    Really great tutorial! From having little to no idea about how Python Mocks works to now having a good understanding. Time to improve my understanding now through practice, thank you!

  • @aashrayzaveri9510
    @aashrayzaveri9510 2 місяці тому

    Great explanation. Was struggling with the concept. Now I am confident with the topic

  • @alexdzehil7194
    @alexdzehil7194 2 роки тому +2

    Спасибо)) Только в работе как раз необходимость возникла в тестирование углубиться, а тут такой подгон. Спасибо Олег, во многом и благодаря вашим роликам сменил профессию с тренера по футболу, на пайтон разработчика!)

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      Вау, это круто! Не поделитесь ли историей перехода?

    • @alexdzehil7194
      @alexdzehil7194 2 роки тому

      @@RedEyedCoderClub если коротко то можно глянуть на ютубе "Moscow Python Podcast из преподавателя в разработчики". Если чуть длиннее, то переход занял у меня ровно год активного изучения питона. Начал с бесплатных курсов на степике, там же курс по линуксу, затем книги и в том числе делал блоги на джанго и фласке по вашим обучающим видео с русскоязычного канала. Затем платные курсы от создателей подкаста в который меня потом и пригласили. Скажу что то что прошел ваш курс и сделал блог на джанго мне очень пригодилось при прохождении платных курсов. Там суть в том что короткая вводная часть и затем проект на фласке или джанго, я выбрал джанго и чувствовал себя поувереннее своих сокурсников, успешно защитил проект и устроился на работу. Компания у нас небольшая да и в современных реалиях от разработчика при постановке задачи также требуется грамотная систем логирования и тестирование. Вот сейчас углубляюсь в тестирование и логирование также по вашим роликам, так как на курсах этому уделяется очень мало времени.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому +2

      @@alexdzehil7194 Спасибо большое за ответ. Я вас от всей души поздравляю и желаю вам успехов! Действительно очень здорово, что вы вот так взяли и переключились. Это очень тяжело. Не каждый так может, а вы смогли. Просто прекрасно!

  • @josesalgado3540
    @josesalgado3540 2 роки тому

    Great video!!! Thank you so much.

  • @pythongabi
    @pythongabi Рік тому

    Thank you, a really helpful video. I like the examples chosen for the video. +1 subscriber

  • @AVISH747
    @AVISH747 6 місяців тому

    Excellent. I was breaking my head on mock and patch.. now its crystal clear.

  • @rugmaable
    @rugmaable 7 місяців тому

    Thanks for the explanation. The mock is very powerful. I feel conformable starting to use it now

  • @bonnymunga2969
    @bonnymunga2969 7 місяців тому

    You're a saviour man. I had issues with DI and mocks but this video has simplified everything for me. Great explanation!👏

  • @Spayke201
    @Spayke201 Рік тому

    Amazing video! Congrats and thanks a lot!! So helpful!

  • @brajesh42
    @brajesh42 Рік тому

    Amazing video. Simplified demo on how to write UT with mocks. Thanks

  • @4rtcrt321
    @4rtcrt321 2 роки тому +1

    Олег Молчанов енто ты?

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому +1

      Да, это я

    • @4rtcrt321
      @4rtcrt321 2 роки тому

      @@RedEyedCoderClub узнал по голосу.
      Спасибо за отличный контент!
      Потдержу тебя чем смогу)

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      Спасибо! Рад, что нравится

  • @emma_promise_smartnbc4331
    @emma_promise_smartnbc4331 5 місяців тому

    Thanks. Was finding it difficult understanding, U made it clear

  • @जैराधाकृष्ण

    Many Thanks. Can we get code written?

  • @TheSirgo23
    @TheSirgo23 7 місяців тому

    This video is just awesome. I was stuck reading docs and couldn't apply it in my test cases. Thanks a lot for this great explanation.

  • @ИванИванов-з1е2с
    @ИванИванов-з1е2с 2 роки тому

    Thanks to the author --- interesting video

  • @abdulmagomedov
    @abdulmagomedov Рік тому

    Awesome! Thank you very much!

  • @durgeshkshirsagar5160
    @durgeshkshirsagar5160 Рік тому

    Great tutorial. Thank you for sharing the knowledge.

  • @PlanetLogical
    @PlanetLogical 9 місяців тому

    Great video. The explanations are extremely clear and easy to follow.

  • @bactran7799
    @bactran7799 5 місяців тому

    amazing, I can understand mock and patch now. Thank you so much

  • @uchesamuelottah559
    @uchesamuelottah559 10 місяців тому

    This is the best explanation ive ever seen in my life+!! You're aweskme

  • @maronthehill
    @maronthehill 9 місяців тому

    2:10 How is the test_add() method called?

    • @Jeremiah_
      @Jeremiah_ Місяць тому

      The unittest module uses the naming convention of the function to execute the test. So let’s say you just remove the ‘test’ from test_add it wouldn’t be able to execute the function. To wrap up the explanation, the unittest module requires strict naming convention in order for it to execute a particular unit or suite of multiple isolations.

  • @vibhourjain
    @vibhourjain 8 місяців тому

    this is great video, with this one video i wrote my 1st unit test case of my project. Thanks

  • @khadija3246
    @khadija3246 Рік тому

    Thank you! This is a great explanation. :)

  • @RazanIbrahimOmerMohamed
    @RazanIbrahimOmerMohamed Рік тому

    Excellent tutorial. Thanks!

  • @ulisespallares8
    @ulisespallares8 2 роки тому

    👍👍👍👍👍👍👍👍👍👍👏👏👏👏👏👏👏👏 THANKS

  • @shiblyaziz4528
    @shiblyaziz4528 Рік тому

    Your work is excellent, thank you!

  • @sandeepamarnath2272
    @sandeepamarnath2272 Рік тому

    Very well explained!! Thank you!

  • @stelecoms00
    @stelecoms00 Рік тому

    OMG - you have made it so easy !! Thank you so much ❤

  • @JonhMalcovich
    @JonhMalcovich Рік тому

    Exelent !!! Thanks for sharing this!

  • @bikkinarohith1006
    @bikkinarohith1006 Рік тому

    One of the best vedioes on Python Mocks👏👏👏

  • @GabrielVeloz-x4q
    @GabrielVeloz-x4q Рік тому

    Great explanation and easy to understand, thanks!

  • @nishugurung2339
    @nishugurung2339 Рік тому

    This has been an awesome video. Thanks a bunch!

  • @freelife1000
    @freelife1000 2 роки тому

    thx, crystal clear.

  • @КсюшаМаркина-э7н
    @КсюшаМаркина-э7н 2 роки тому

    I get a lot of knowledge by watching your video lessons. Thank you very much!

  • @sutischolar
    @sutischolar Рік тому

    My god, thank you

  • @ОльгаЛебедева-ц1в
    @ОльгаЛебедева-ц1в 2 роки тому

    This is a helpful video. For me exactly. Thank you.

  • @joaosousa6427
    @joaosousa6427 2 роки тому

    Excelent information and examples, thanks bro!

  • @annaaniytkina5963
    @annaaniytkina5963 2 роки тому

    Thank you for the video. Always very informative.

  • @_KREKHOVETSKYI_
    @_KREKHOVETSKYI_ 2 роки тому

    I'm taking courses that have this topic. I didn't understand anything there at all. However, as soon as I watched the first 10 minutes of your video, everything immediately became clear. Thank you very much!

  • @suprajakarumanchi9683
    @suprajakarumanchi9683 2 роки тому

    Very good Video. Example chosen is very apt to the real world programming

  • @a_mortal7511
    @a_mortal7511 2 роки тому

    Thanks for the perfect example, I wish I could like more than once 👍

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      Thank you! There are more videos to like and comment :D

  • @kostya9169
    @kostya9169 2 роки тому

    Cool and clear video tutorial. Thank you this is very helpful.

  • @EmadRahman_eee
    @EmadRahman_eee 2 роки тому

    Amazing tutorial. Please make a series on Pytest. Thank you.

  • @kostya9169
    @kostya9169 2 роки тому

    Thank you very much for such a detailed and informative video tutorial, this information is very important to me.

  • @philveo
    @philveo 2 роки тому

    hi, i have seen many and many tutos python mocks, but this one is simple, clear and understable. 👍 and many thanks !

  • @serg_D
    @serg_D 2 роки тому

    The video review is very informative and useful. Thank you.

  • @ТатьянаЧеремшова
    @ТатьянаЧеремшова 2 роки тому

    This is an interesting video. For more of these in UA-cam 👍👍👍

  • @odint.serega1099
    @odint.serega1099 2 роки тому

    Thank you, everything is clear and understandable!

  • @von-fur-wegen-gegenolli9196

    Great explanation!

  • @hummels11001
    @hummels11001 Рік тому

    Amazing video!

  • @yanuareko4307
    @yanuareko4307 9 місяців тому

    Thanks

  • @munibarshad7454
    @munibarshad7454 2 роки тому

    Thank you, beautifully explained

  • @МаринаПеткова-у9м
    @МаринаПеткова-у9м 2 роки тому

    Thank you for a detailed and informative video tutorial. I look forward to new lessons from you.

  • @OlegBosi
    @OlegBosi 2 роки тому

    Very good!!!!!

  • @duke007x3
    @duke007x3 2 роки тому

    Thanks🙏

  • @maximoarceci9424
    @maximoarceci9424 Рік тому

    that was a amazing video. Thank you!

  • @tamarastepanova6435
    @tamarastepanova6435 2 роки тому

    This is something new for me. Thank you.

  • @ПрохорСергеев-я1ч
    @ПрохорСергеев-я1ч 2 роки тому

    This is something new for me. Thank you.

  • @ЛарисаАфаринова-д6и

    Video is great! It was interesting.👍👍👍

  • @Slone-uk1is
    @Slone-uk1is Рік тому

    I am appreciated for this great tutorial!

  • @avbolshakov
    @avbolshakov 2 роки тому

    Спасибо! Хорошо бы возобновить рубрику "ответы на вопросы") Но уже на английском

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      Ага, только вопросов что-то не много совсем

  • @scottwickersham2408
    @scottwickersham2408 2 роки тому

    Excellent explanation! Nice job!

  • @Mehdi-hw6yi
    @Mehdi-hw6yi 2 роки тому

    Thank you for the video, very clear but how can you mock multiple elements in one function? For example if a function calls two functions.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому +1

      It's a good question!
      First of all you can use more then one @patch decorator
      @patch('main.one_func')
      @patch('main.two_func')
      def test_function():
      pass
      Also you can use patch as a context manager. Smth like this:
      with patch('main.one_func') as mock_one_func:
      pass
      Also you can use patch() inline. Smth like this:
      mock_one_func = patch('main.one_func').start()
      ...
      mock_one_func.stop()
      It's all about the scope.

    • @Mehdi-hw6yi
      @Mehdi-hw6yi 2 роки тому

      @@RedEyedCoderClub Thank you, I have tried the first two solutions and they work well. Not sure how to use the last one though.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      It's great!

  • @zakchips
    @zakchips 2 роки тому

    What a gift! Thanks.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому

      Isn't it too basic for you?

    • @zakchips
      @zakchips 2 роки тому

      @@RedEyedCoderClub But it was only introduction. And may be you'll find some time to continue this topic comparing different approaches in mocking. what are advantages if present in module requests_mocking (or responses) comparing with unittest.mock patch. Or creating custom exceptions working with raise_for_status (had some troubles testing them at my work). Thank you very much.

    • @RedEyedCoderClub
      @RedEyedCoderClub  2 роки тому +1

      Yep, that's right. I knew that it's too basic for you, and planned to make more.

  • @arinamiheeva2554
    @arinamiheeva2554 2 роки тому

    Great. Just what I was looking for.