Category: Software Development
-
python-dectest — Improved unittest.TestCase
I have released the first version of dectest for Python (Github), an improved version of unittest.TestCase. It is a drop-in replacement with two improvements: decorators for tests, setup, and teardown methods. This is not only more explicit than the “magic” names of unittest, it also allows multiple setup and teardown methods per class. A patch() helper method that calls unittest.mock.patch(),…
-
Python asserts and json-get with type hints
I released new versions of python-asserts (0.8.2) and python-json-get (1.1.0) that include type hints, so that typecheckers like mypy will now be able to type check calls to those libraries. json-get uses asserts for its tests and it’s now possible to type check it without –ignore-missing-imports. In addition, json-get now has a json_get_default() function that returns a default…
-
dbupgrade – A Database Migration Tool – published
Yesterday I published dbupgrade, a simple database migration tool, written in Python. It allows you to put database migration files (simple SQL files with a special header) into a directory and upgrade your database schema. While this is a new project, it was extracted from an internal library I’ve been using for years and should…
-
Chipcard Woes
One of my customers, a large dental practice, had a problem from time to time when reading Krankenversicherungskarten (German health insurance card, KVK). The insurance number got all garbled up, which led to problems when reading the patient’s insurance data into the health care application. After their sysadmin and I analysed the situation it seemed…
-
VirtualBox on i386 with amd64 Kernel
I have recently started to use an amd64 kernel on my i386 Debian unstable system. Unfortunately, VirtualBox OSE does not work with that setup. When I try to start a virtual machine, it fails with an oblique error message: RTR3Init failed with rc=-1912 (rc=-1912) The VirtualBox kernel modules do not fit to this version of VirtualBox. The…
-
Programming Warts Wiki
There is a new Programming Warts Wiki. I think this is a great idea, since it encourages discussion about the various advantages and disadvantages of different programming languages and may help to remove some kinks in those languages.
-
setuptools breaks PYTHONPATH
setuptools and egg files are a great way to distribute Python packages and programs. But today I stumbled over a really braindead design decision: setuptools overrides Python’s standard module search path algorithm in a very inconvenient way. Normally, when Python looks for a module or package, it first looks in the current directory, then in any…
-
gnome-keyring with Python
The documentation on gnome-keyring I discovered helped me to access it successfully with Python. I’ve written a small module that fetches and stores a username and a password for some server. Some notes: The attributes are freeform, but there a some common attributes for network hosts. These are: “user”, “domain”, “server”, “object”, “protocol”, “authtype”, and “port”. Actually there is…
-
Documentation for libgnome-keyring
I was trying to find documentation for libgnome-keyring for little project I am writing, which accesses a password-protected web service. Unfortunately there is no real documentation for it. No API documentation (well, there are a total of two functions documented), no tutorial. Finally I found this document in GNOME’s Subversion repository. Better then nothing, but why isn’t this…
-
Selection in GtkTextBuffer
I’ve recently played around with GtkTextBuffer. It’s a rather nice text editing widget (or rather widget part). Unfortunately it misses one functionality, which is also missing from GtkEditable derived widgets: A signal for selection changes. There are two workarounds: You can setup a notification on the “has-selection” property like this: buffer.connect(“notify”, on_buffer_notify) def on_buffer_notify(buffer, prop): if prop.name ==…