Upload
nuxeo
View
115
Download
1
Tags:
Embed Size (px)
DESCRIPTION
This presentation at OSDC 2013 discusses building and testing under CI a desktop application written in Python using Qt, nose and Jenkins.
Citation preview
OSDC 2013 - Paris
Building and testing under CIa desktop application written in
Python using Qt, nose and Jenkins
Antoine [email protected]
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
3
Agenda
• Introduction: Nuxeo & Nuxeo Drive
• Nuxeo Drive architecture
• Coding session
• Build and continuous integration
• Roadmap
4
Introduction
5
Useful links
• Source code: github.com/nuxeo/nuxeo-drive
• Documentation: doc.nuxeo.com
• Continuous integration: qa.nuxeo.org
• Backlog: jira.nuxeo.com - "Nuxeo Drive"
• Nuxeo: nuxeo.com / nuxeo.org
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
7
Demo
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
Main features
• Command line
• Systray GUI
• Background synchronization
• Robust to network errors: goes offline
• Token based authentication + revocation
• Multiple server bindings
10
Demo
11
Architecture
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
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
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
15
Coding session
16
Dev tools
• git
• vi / Sublime Text / Eclipse + PyDev
• nose (+ ipdbplugin) / PyUnit
• Jenkins
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
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
19
Build under continuous integration
20
Goal
• Build standalone binary packages
✔ For Windows: .msi
✔ For OS X: .dmg
● Embed Python, Qt, PyQt and all required libraries
● Don't interfere with already installed packages
21
Build environment setup
• Install Python 2 (using Homebrew for OS X)
• Install Qt / PyQt
✔ Linux: sudo apt-get install python-qt4
✔ OS X: sudo brew install pyqt
✔ Windows: install binary package
● Install pip with setuptools: sudo easy_install pip
● Install freeze program
✔ Os X: pip install py2app
✔ Windows: install cx_Freeze
22
Application freeze
• Clone nuxeo-drive from Github
git clone https://github.com/nuxeo/nuxeo-drive.git
● Grab dependencies
sudo pip install -r requirements.txt
• Run freeze
• Windows
python.exe setup.py --freeze –dev bdist_msi
• OS X
python setup.py py2app
sh tools/osx/create-dmg.sh
23
Demo
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
25
Roadmap
26
Nuxeo 5.8
• HTTP proxy
• Handle readonly documents
• GUI improvements
✔ Unified settings menu
✔ Home folder configuration
✔ Status icon
✔ Last synchronization date
27
Nuxeo 5.x
• GUI improvements
✔ Notifications ("10 files synchronized in 8 seconds")
✔ Recently modified files
✔ Suspend synchronization
✔ Multiple server bindings
• Versioning and auto-upgrade
• Explorer / Finder decoration + Right click
• Optimization of local changes detection
28
Questions