Mobileread
Unit testing calibre plugins
#1  jgoguen 05-13-2020, 11:54 AM
I just realized I can run arbitrary Python scripts through calibre-debug, which is finally allowing me to start writing some proper tests. There's a couple things I'm wondering about though. I'll be running everything on a Linux machine which I hope makes it all easier.



Reply 

#2  kovidgoyal 05-13-2020, 12:47 PM
1) You append to sys.path

2, 3) See the various environment variables calibre uses, including controlling interface language and config directory
https://manual.calibre-ebook.com/customize.html#environment-variables
Note that binary builds of calibre from the python 3 betas onward always use UTF-8 regardless of environment variables.
For python 2 calibre things are more complicated, since there python's internal encoding selection mechanics are used.

4) Just create your own empyt config dir and tell calibre to use it via the env var above and then use calibre-customize -b to install your plugin into that config dir.
Reply 

Today's Posts | Search this Thread | Login | Register