Setup pytest-django with pytest-postgresql

At work we have a pretty standard stack for the backend. A Django monolith app with relationnal DB, PostgreSQL. When revamping our test infrastructure, I traded reliablity for speed, using sqlite with spatialite. Setup of spatialite on macOS can be quite cumbersome to make it work with python (I’m skipping this part here). The setup turn out to be not so simple because I wanted: setup of 3 DB. fast setup/teardown. It turns out pytest-postgresql, which will starts a postgresql cluster on your machine, is way faster than using testcontainer. ...

May 22, 2025 · 4 min · 713 words · Rémi Desgrange

How to Handle Browser Clipboard in JS

The other day I wanted to be able to copy/paste files to an HTML textarea. like in Github or GitLab. Since I’m not a frontend expert I quickly browsed to MDN. <textarea id="mytextarea"></textarea> const myTextArea = document.querySelector("#mytextarea") myTextArea.addEventListener("paste", (e) => { let paste = (event.clipboardData || window.clipboardData).files; console.log(paste) }) Even if you didn’t read the doc, you might think that if you paste some text, the files element would be empty. Think twice. The clipboardData object contains 2 DataTransferItems objects that are iterator, files and items. An iterator means, once you have consulted it, data is gone. ...

December 15, 2022 · 2 min · 260 words · Rémi Desgrange

Why I Love Vuejs

Background I’m a backend developer. I went to embedded software dev, that all the industry are now calling “IoT”, because it is much more cooler, to SysAdmin, now called DevOps, to backend developper. I never learned frontend dev, I always use all the possible helper builds to help me not do it. But really don’t like this way of using wrapper blindly and not understand what you do and copy paste StackOverflow stuff into my code. ...

April 11, 2020 · 3 min · 583 words · Rémi Desgrange

My Python Setup

The Python programming language is, I think, a fantastic tool. But there is two fucking thing that really makes me sad: packaging and dependency management. Today, my Linux distribution, Arch, decide that it was OK to migrate python 3.8. And it broke tons of shit on my machine. So I took a moment to re-install and harden stuff so that it doesn’t happen again. Pyenv To Have Multiple Version I use Pyenv with the plugin to handle virtualenv. I use to rely on pew. But pew rely on the system Python. So today I couldn’t use my virtualenv… pew is a great tool but I don’t know why it use a fork of pythonz to handle version management. Latest version that you can install with pew is 3.5. 3.5 was release in 2015 ...

November 18, 2019 · 2 min · 228 words · Rémi Desgrange