Generative AI for Technical Writer or Information Developers
Building and testing a desktop application written in Python
1. OSDC 2013 - Paris
Building and testing under CI
a desktop application written in
Python using Qt, nose and Jenkins
Antoine Taillefer
ataillefer@nuxeo.com
2. 2
About me – Antoine Taillefer
• Graduated from ENSEEIHT in 2006
• Worked for 5 years for an Open source solutions
integrator
• Working at Nuxeo since 2011
✔
Software engineer
✔
Involved in consulting / training
• Languages :
✔
Java
✔
Python
6. 6
Nuxeo Platform
• Open source content management platform
• Repository available through:
✔
Web user interface
✔
REST services (Nuxeo Drive)
✔
Shell
• Java based
●
Modular and extensible => build business apps
●
Configuration tools: Nuxeo Studio / Nuxeo IDE
8. 8
Nuxeo Drive
• Fully open source, on Github, LGPL
• Desktop client for Nuxeo
• Available for Windows and OS X
• Roundtrip synchronization
• Selection of the folders to synchronize
• Synchronization of any type of content
• Conflict management (allows offline work)
• Quick edit
9. 9
Main features
• Command line
• Systray GUI
• Background synchronization
• Robust to network errors: goes offline
• Token based authentication + revocation
• Multiple server bindings
12. 12
Server-side
• Addon for Nuxeo
• Token authentication service
• Change detection based on audit log
• Pluggable service layer
• REST API: basic operations
✔
getChanges()
✔
downloadFile()
✔
createFile()
13. 13
Client-side
• UI thread / Synchronization thread
• Local storage: maintain pair states
• Token based authentication
• Local file system client
• Remote HTTP client (JSON)
• Synchronization: infinite loop
✔
Polling for remote changes
✔
File system scan for local changes
✔
Resolution and synchronization
14. 14
Main libraries
• Threading: threading
• Command-line : argparse
• GUI: PyQt4 (GPL)
• Storage / ORM: sqlalchemy
• OS detection: sys
• File system: os
• HTTP exchanges: urllib2, json, poster
• Logging: logging
• Testing: nose
16. 16
Dev tools
• git
• vi / Sublime Text / Eclipse + PyDev
• nose (+ ipdbplugin) / PyUnit
• Jenkins
17. 17
Test Driven Development (TDD)
• Goal: PDF conversion of locally synchronized files
• Steps :
✔
Write test scenario
✔
Write test
✔
Run it with nose / PyUnit => should fail
✔
Implement feature
✔
Run test again => should succeed
18. 18
GUI with PyQt
• Goal: add menu entry to open the PDF conversion
output folder
• Steps:
✔
Code function
✔
Add menu action
●
Testing the PyQt GUI?
✔
Simulating clicks with PyQt API by sending signals
✔
PyQt QTest + unittest
✔
TDriver
✔
Squish
24. 24
Continuous integration
• Jenkins
• Several jobs
✔
Build Nuxeo addon with Maven
✔
Freeze for Windows => msi
✔
Freeze for OS X => dmg
✔
Functional tests (depends on previous jobs)
➔
Launch Nuxeo server with Drive addon
➔
Run tests with nose