Reference data while testing

54 views
Skip to first unread message

Mike Dewhirst

unread,
Oct 2, 2023, 10:31:28 PM10/2/23
to django...@googlegroups.com

This is probably in the docs so please drop me a link if you can.

My project has fifteen or more tables of reference data which determine how the software behaves and therefore is critical to unit testing.

Fixtures are unworkable and I  need to respond to the actual reference data.

How can i do real lookups (read-only) during tests?

Thanks

Mike




--
(Unsigned mail from my phone)


Jun Say

unread,
Oct 3, 2023, 12:36:38 AM10/3/23
to django...@googlegroups.com
Thank you for your email.
https://hahaha0505.netlify.app/
If  you have any questions, please share with me.
Thank you.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/651b7cc1.170a0220.54b8d.3ebcSMTPIN_ADDED_MISSING%40gmr-mx.google.com.

herve bineli

unread,
Oct 3, 2023, 2:02:40 AM10/3/23
to django...@googlegroups.com
Hi Mike,

I will suggest you use a database framework like SQLAlchemy to access your tables' data with read-only queries.
Then you use the data queried to set your test cases using a testing library like Pytest.

Do let know if you have other concerns with this approach.

Best Regards,
BINELI Arsene


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/651b7cc1.170a0220.54b8d.3ebcSMTPIN_ADDED_MISSING%40gmr-mx.google.com.


--
BINELI MANGA Hervé Arsène
Ingénieur Informaticien - ENSPY
(+237) 691388922 / 699946323

Alessandro Madruga Correia

unread,
Oct 3, 2023, 2:27:53 PM10/3/23
to django...@googlegroups.com
On Mon, Oct 2, 2023 at 11:30 PM Mike Dewhirst <mi...@dewhirst.com.au> wrote:

This is probably in the docs so please drop me a link if you can.

My project has fifteen or more tables of reference data which determine how the software behaves and therefore is critical to unit testing.

Fixtures are unworkable and I  need to respond to the actual reference data.

How can i do real lookups (read-only) during tests?


--
  ,= ,-_-. =.   [<o>] Alessandro Madruga Correia
 ((_/)o o(\_))  [http://counter.li.org]       Debian User# 342751 
   `-'(. .)`-'    "O fanatismo é a única forma de força de vontade 
       \_/        acessível aos fracos." (Friedrich Nietzsche)

Qayyam Hussain

unread,
Oct 3, 2023, 5:38:47 PM10/3/23
to django...@googlegroups.com
Sure I'll what how much you pay me? 

Mike Dewhirst

unread,
Oct 3, 2023, 7:33:44 PM10/3/23
to django...@googlegroups.com
Thank you but unfortunately, none of the suggestions are appropriate. Here is more information.

We have a complex system where - in the opinion of a chemical expert - it is possible to state that a particular chemical risk profile has been correctly calculated by the software.

In addition to molecular properties, base and comparison information used bythe software to perform those risk calculations - at multiple end-points - is imported from many international regulatory authorities and stored in (Django/Postgres) reference tables. There are hundreds of thousands of records all of which are (somewhat) regularly updated when those authorities notify changes.

Once an expert confirms a risk profile for a particular chemical we use a Django management command to generate a new Django test in our test harness. The objective is to run that/those tests in our regular testing regime to prove the software - and reference data - is still OK.

If the reference data or the software changes, we want to discover any discrepancies from the expert opinion.

Automating creation of those tests (underpinning the expert opinion) is important because it is the only way I can see to stay sane. I am not a chemical expert.

I was hoping someone could suggest a way - perhaps using dbalias - to allow read-only use of the reference portion of the database. Another thought I had was to load a dump of the reference data prior to starting the tests but I believe Django would simply wipe that after the first test.

Factory boy is really good but cannot provide accurate reference information. I can see SQLAlchemy might be a solution but I'd prefer to stay within Django/Postgres.

Still looking ...

Thanks
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAOofabfi%3DErk535OgDo5nPU%3DwM1pVp%3D93muppuGMt1c6M2vSZA%40mail.gmail.com.


-- 
Signed email is an absolute defence against phishing. This email has
been signed with my private key. If you import my public key you can
automatically decrypt my signature and be sure it came from me. Your
email software can handle signing.
OpenPGP_signature
Reply all
Reply to author
Forward
0 new messages