Pytest | Django | Introducing Fixtures and Fixture Factory

แชร์
ฝัง
  • เผยแพร่เมื่อ 12 เม.ย. 2021
  • Pytest is a popular python test automation framework. Here we look at getting started with Pytest fixtures with Python Django. In this tutorial we continue to explore Pytest, specifically focusing Pytest fixtures. We build a range of different simple examples using Fixtures, moving to using fixtures external to our test files. The final stage, we build an example of factory as a fixture and showcase the flexibility that if offers in our testing.
    Code Repository
    github.com/veryacademy/pytest...
    🐱‍🏍Would you like to SUPPORT US FURTHER so that we can make even more great content - Please consider joining our members community.
    / @veryacademy
    👍SUBSCRIBE to get more free tutorials, courses and code snippets!
    / @veryacademy

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

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

    Thank you sir.
    Your tutorials are thorough, detail-oriented and at a moderate pace without making a beginner like me feel overwhelming.
    Wish your channels get more recognition.

  • @samuelebonini8004
    @samuelebonini8004 3 ปีที่แล้ว +13

    As a suggestion for a future video, I'd love to see something on generic relationships, and maybe a real-world possible use case example that goes beyond that's written in the official docs. Thank you for the quality content!

  • @shubhanksaxena171
    @shubhanksaxena171 3 ปีที่แล้ว +4

    Underrated but one of the best development content channel! Hope that you reach great heights. Thank you for this amazing content!

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

    Maaan, I was looking for such clear explanation for 2 days. Thanks a lot!

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

    i was really looking for a video like this since long on test cases .... so a big thank you Sir!! love from INDIA !

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

      Glad it was helpful!

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

    Awesome video, so well organized. Love this channel.

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

    very very good series (especially giving chance to replicate the code) .Thanks a lot

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

    This is great! Thank you!

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว

      You're very welcome!

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

    Thank you!

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

    thks i love your engligh lol It's very simple to understand (i'm french) haha

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

    Unique Content!

  • @mueezkhan280
    @mueezkhan280 2 ปีที่แล้ว

    what you mentioned at 19:10 - 19:25 about data persistence using factories,
    can you please guide me how it can be achieved ?

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

    Thank you.

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

    Oh I was waiting for the solution to the error when scope "session" is used. I don't understand why it is not working

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

    😍😍😍

  • @you.coding
    @you.coding ปีที่แล้ว +1

    Can you please show how to connect to a PostgreSQL database during test? It doesn't connect to the default one automatically.

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

      Django will use the same connection settings as in your settings.py for tests, but will use a different database?

    • @you.coding
      @you.coding ปีที่แล้ว

      @@veryacademy well I have got the solution.
      If you use some remote postgres database like elephantsql or neon console, these database user doesn't have 'superuser' or 'createdb' permission to create a new test db inside it.
      So I use the '--reuse-db' argument during pytest command to use the main db as test db.
      ``` pytest -rP --reuse-db ```
      Hope I am doing it right way.
      Thanks

  • @saikatmukherjee8095
    @saikatmukherjee8095 3 ปีที่แล้ว

    Sir i am unable to use the set_password option , showing none type object has no attribute with set_password ... but the user is created succesfully i have printed , so why this is none ? no clue from google !

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

    How can I split fixtures in my django project? I mean, each app with its own fixtures

    • @veryacademy
      @veryacademy  2 ปีที่แล้ว

      Make a fixtures folder in each app and only load what you need

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

    sir plz make a video django with mako template

    • @veryacademy
      @veryacademy  3 ปีที่แล้ว

      Hi Sonu, just wondering why you are using mako? Not saying you shouldn't and so on - I really just wondered - such a niche template library.

    • @sonusardar8317
      @sonusardar8317 3 ปีที่แล้ว

      @@veryacademy sir plz make video django advance template concept

  • @nikhilbhardwaj6055
    @nikhilbhardwaj6055 2 ปีที่แล้ว

    But you didn't show how to create one User object with scope session, create one object for all test cases, btw it was good