11#! /usr/bin/env python
2- #This file is part of Tryton. The COPYRIGHT file at the top level of
3- #this repository contains the full copyright notices and license terms.
2+ # This file is part of Tryton. The COPYRIGHT file at the top level of
3+ # this repository contains the full copyright notices and license terms.
44import re
55import os
6- from setuptools import setup
6+ import sys
7+ from setuptools import setup , Command
78import ConfigParser
9+ import unittest
810
911requires = ['boto' ]
1012
1113
1214def read (fname ):
1315 return open (os .path .join (os .path .dirname (__file__ ), fname )).read ()
1416
17+
18+ class SQLiteTest (Command ):
19+ """
20+ Run the tests on SQLite
21+ """
22+ description = "Run tests on SQLite"
23+
24+ user_options = []
25+
26+ def initialize_options (self ):
27+ pass
28+
29+ def finalize_options (self ):
30+ pass
31+
32+ def run (self ):
33+ if self .distribution .tests_require :
34+ self .distribution .fetch_build_eggs (self .distribution .tests_require )
35+
36+ from trytond .config import CONFIG
37+ CONFIG ['db_type' ] = 'sqlite'
38+ os .environ ['DB_NAME' ] = ':memory:'
39+
40+ from tests import suite
41+ test_result = unittest .TextTestRunner (verbosity = 3 ).run (suite ())
42+
43+ if test_result .wasSuccessful ():
44+ sys .exit (0 )
45+ sys .exit (- 1 )
46+
47+
1548config = ConfigParser .ConfigParser ()
1649config .readfp (open ('tryton.cfg' ))
1750info = dict (config .items ('tryton' ))
@@ -39,19 +72,20 @@ def read(fname):
3972setup (
4073 name = 'trytond_attachment_s3' ,
4174 version = info .get ('version' , '0.0.1' ),
42- description = info . get ( 'description' , '' ) ,
75+ description = 'Amazon S3 backend for Tryton Attachments' ,
4376 long_description = read ('README.md' ),
4477 author = 'Openlabs Technologies & Consulting (P) Limited' ,
4578 author_email = info .get ('email' , '' ),
46- url = info . get ( 'website' , '' ) ,
79+ url = 'https://github.com/openlabs/trytond-attachment-s3' ,
4780 package_dir = {'trytond.modules.attachment_s3' : '.' },
4881 packages = [
4982 'trytond.modules.attachment_s3' ,
5083 'trytond.modules.attachment_s3.tests' ,
5184 ],
5285 package_data = {
53- 'trytond.modules.attachment_s3' : info .get ('xml' , []) +
54- ['tryton.cfg' , 'locale/*.po' , '*.odt' , 'icons/*.svg' ],
86+ 'trytond.modules.attachment_s3' : info .get ('xml' , []) + [
87+ 'tryton.cfg' , 'locale/*.po' , '*.odt' , 'icons/*.svg'
88+ ],
5589 },
5690 classifiers = [
5791 'Development Status :: 5 - Production/Stable' ,
@@ -73,4 +107,7 @@ def read(fname):
73107 """ ,
74108 test_suite = 'tests' ,
75109 test_loader = 'trytond.test_loader:Loader' ,
110+ cmdclass = {
111+ 'test' : SQLiteTest ,
112+ },
76113)
0 commit comments