Initial commit

This commit is contained in:
resteve 2016-01-18 23:01:36 +01:00
commit 916d3f9729
7 changed files with 211 additions and 0 deletions

1
CHANGELOG Normal file
View File

@ -0,0 +1 @@

14
COPYRIGHT Normal file
View File

@ -0,0 +1,14 @@
Copyright (C) 2015 TrytonSpain
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

27
INSTALL Normal file
View File

@ -0,0 +1,27 @@
Installing trytontasks-tests
============================
Prerequisites
-------------
* Python 2.7 or later (http://www.python.org/)
* invoke (https://pypi.python.org/pypi/invoke/)
* See requeriments.txt
Installation
------------
Once you've downloaded and unpacked the trytond_esale source release, enter the
directory where the archive was unpacked, and run:
python setup.py install
Note that you may need administrator/root privileges for this step, as
this command will by default attempt to install module to the Python
site-packages directory on your system.
For advanced options, please refer to the easy_install and/or the distutils
documentation:
http://peak.telecommunity.com/DevCenter/EasyInstall
http://docs.python.org/inst/inst.html

40
README Normal file
View File

@ -0,0 +1,40 @@
Tryton Tasks Tests
==================
Test modules and pyflakes
Installing
----------
See INSTALL
Support
-------
For more information or if you encounter any problems with this module,
please contact the programmers at
TrytonSpain
-----------
website: http://www.tryton-erp.es/
project: https://bitbucket.org/trytonspain/
If you encounter any problems with Tryton, please don't hesitate to ask
questions on the Tryton bug tracker, mailing list, wiki or IRC channel:
https://bitbucket.org/trytonspain/
License
-------
See LICENSE
Copyright
---------
See COPYRIGHT
For more information please visit the Tryton web site:
http://www.tryton-erp.es/

42
setup.py Normal file
View File

@ -0,0 +1,42 @@
#!/usr/bin/env python
#This file is part of trytontasks_tests. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
from setuptools import setup, find_packages
import os
execfile(os.path.join('trytontasks_tests', 'version.py'))
def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read()
setup(name=PACKAGE,
version=VERSION,
description='Tryton Tasks Tests',
long_description=read('README'),
author=AUTHOR,
url=WEBSITE,
download_url="https://bitbucket.org/trytonspain/trytontasks-tests",
packages=find_packages(),
package_data={},
scripts=[],
classifiers=[
'Development Status :: 5 - Production/Stable',
'Environment :: No Input/Output (Daemon)',
'Intended Audience :: Developers',
'License :: OSI Approved :: GNU General Public License (GPL)',
'Operating System :: OS Independent',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries',
],
license=LICENSE,
install_requires=[
'invoke>=0.11.1',
'blessings',
'pyflakes',
],
extras_require={},
zip_safe=False,
#~ test_suite='trytontasks_tests.tests',
)

View File

@ -0,0 +1,79 @@
#This file is part of trytontasks_tests. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
import functools
import unittest
import time
import os
from invoke import task, run
from blessings import Terminal
from trytontasks_modules import read_config_file
from trytond.config import config
t = Terminal()
@task
def test(dbtype='sqlite', module=None):
'Run Tryton test module/s'
Modules = read_config_file()
modules = Modules.sections()
modules.sort()
if module:
if not module in modules:
print "Not found " + t.bold(module)
return
modules = [module]
if dbtype == 'sqlite':
configfile = 'sqlite.conf'
database_name = ':memory:'
else:
configfile = 'trytond.conf'
database_name = 'test_' + str(int(time.time()))
if not os.path.exists(configfile):
print "Not found " + t.bold(configfile)
return
os.environ['DB_NAME'] = database_name
import trytond.tests.test_tryton as test_tryton
print "Run %s in %s database" % ('all' if len(modules) > 1 else module, database_name)
config.update_etc(configfile)
update_etc = functools.partial(config.update_etc, configfile)
config.update_etc = lambda *args, **kwargd: update_etc()
#~ config.update_etc(options)
config.update_etc = lambda *args, **kwargs: None
suite = test_tryton.modules_suite(modules=modules)
text_runner = unittest.TextTestRunner().run(suite)
print text_runner
@task
def pyflakes(module=None):
'Run Tryton test module/s'
Modules = read_config_file()
# remove base (trytond, tryton, proteus...)
Bases = read_config_file('base.cfg')
bases = Bases.sections()
for base in bases: Modules.remove_section(base)
modules = Modules.sections()
modules.sort()
if module:
if not module in modules:
print "Not found " + t.bold(module)
return
modules = [module]
for module in modules:
path = '%s/%s' % (Modules.get(module, 'path'), module)
files = []
for f in sorted(os.listdir(path)):
if f.endswith('.py') and f not in ['__init__.py', 'setup.py']:
files.append('%s/%s' % (path, f))
run('pyflakes %s' % ' '.join(files))

View File

@ -0,0 +1,8 @@
#This file is part of trytontasks_tests. The COPYRIGHT file at the top level of
#this repository contains the full copyright notices and license terms.
PACKAGE = 'trytontasks_tests'
VERSION = '0.0.1'
LICENSE = 'GPL-3'
WEBSITE = 'http://www.tryton-erp.es/'
AUTHOR = 'TrytonSpain'