News for hackers. Stuff that matters.
Re:ORMs Are Backwards by nnq on Wednesday September 04, 2019 @04:23AM (#20875091)
Hmm... can one test use in-mem db mocking with django.contrib.postgres fields?

I'll definitely look into this, not a solution for existing projects bc of legacy baggage, but probably the right way to do it. Problem in practice is that you yes what you really want is to mock the db completely, but practically speaking existing code is to entangled with the db adapter specifics, so you end up with running with a "fake real db" :|

Re:ORMs Are Backwards by Scarblac on Wednesday September 04, 2019 @04:38AM (#20875174)
Can you write the tests so that you create object instances and not save them to a database at all? You don't need to test the ORM and database, after all, just your code.
Re:ORMs Are Backwards by collyw on Wednesday September 04, 2019 @07:11AM (#20875973)
The closer you keep things to production, the more likely you are to catch errors that will occur on production.
Re:ORMs Are Backwards by nnq on Wednesday September 04, 2019 @05:58AM (#20875571)
unit tests, yeah, but if you try to get "the most bang for the buck" in like "test a lot with zero/little effort" you'll end up with a layer of "integration tests": that (1) set stuff in db, (2) do stuff, (3) read stuff from db and assert its correctness... A sane ORM would not actively hinder this scenario even cross-dbs or with memory-mocked-dbs, but Django's does!
Re:ORMs Are Backwards by djd20 on Wednesday September 04, 2019 @09:03AM (#20876768)
I don't see the issue - you're asking it to support a feature of one database on another, something it never claims to do. You need to use the same database for testing that you use in production.