Changeset - dd676fdeda0f
[Not reviewed]
default
0 3 1
Mads Kiilerich - 9 years ago 2016-07-28 16:28:34
madski@unity3d.com
setup: move test dependencies to dev_requirements.txt to make them optional

Remove the need for having test tools on production systems. Installing test
dependencies is made an extra explicit step.

pip is the future, but doesn't have the same tests_require features as
setuptools kind of has.

I don't like this way of handling it without setup.py support and with explicit
naming of the ugly dev_requirements.txt ... but that seems to be the way to do
it.
4 files changed with 15 insertions and 12 deletions:
0 comments (0 inline, 0 general)
dev_requirements.txt
Show inline comments
 
new file 100644
 
pytest>=2.7.0,<3.0
 
pytest-runner
 
pytest-sugar>=0.7.0,<1.0.0
 
webtest==1.4.3
 
mock
 
sphinx
docs/contributing.rst
Show inline comments
 
@@ -27,53 +27,57 @@ for more details.
 

	
 
Getting started
 
---------------
 

	
 
To get started with development::
 

	
 
        hg clone https://kallithea-scm.org/repos/kallithea
 
        cd kallithea
 
        virtualenv ../kallithea-venv
 
        source ../kallithea-venv/bin/activate
 
        pip install --upgrade pip setuptools
 
        pip install -e .
 
        paster make-config Kallithea my.ini
 
        paster setup-db my.ini --user=user --email=user@example.com --password=password --repos=/tmp
 
        paster serve my.ini --reload &
 
        firefox http://127.0.0.1:5000/
 

	
 
You can also start out by forking https://bitbucket.org/conservancy/kallithea
 
on Bitbucket_ and create a local clone of your own fork.
 

	
 

	
 
Running tests
 
-------------
 

	
 
After finishing your changes make sure all tests pass cleanly. You can run
 
the testsuite by running ``py.test`` from the project root::
 
After finishing your changes make sure all tests pass cleanly. Install the test
 
dependencies, then run the testsuite by invoking ``py.test`` from the
 
project root::
 

	
 
    pip install -r dev_requirements.txt
 
    py.test
 

	
 
Note that testing on Python 2.6 also requires ``unittest2``.
 

	
 
You can also use ``tox`` to run the tests with all supported Python versions
 
(currently Python 2.6--2.7).
 

	
 
When running tests, Kallithea uses `kallithea/tests/test.ini` and populates the
 
SQLite database specified there.
 

	
 
It is possible to avoid recreating the full test database on each invocation of
 
the tests, thus eliminating the initial delay. To achieve this, run the tests as::
 

	
 
    paster serve kallithea/tests/test.ini --pid-file=test.pid --daemon
 
    KALLITHEA_WHOOSH_TEST_DISABLE=1 KALLITHEA_NO_TMP_PATH=1 py.test
 
    kill -9 $(cat test.pid)
 

	
 
In these commands, the following variables are used::
 

	
 
    KALLITHEA_WHOOSH_TEST_DISABLE=1 - skip whoosh index building and tests
 
    KALLITHEA_NO_TMP_PATH=1 - disable new temp path for tests, used mostly for testing_vcs_operations
 

	
 
You can run individual tests by specifying their path as argument to py.test.
 
py.test also has many more options, see `py.test -h`. Some useful options
 
are::
 

	
 
    -k EXPRESSION         only run tests which match the given substring
 
                          expression. An expression is a python evaluable
setup.py
Show inline comments
 
@@ -17,80 +17,74 @@ def _get_meta_var(name, data, callback_h
 
    if matches:
 
        if not callable(callback_handler):
 
            callback_handler = lambda v: v
 

	
 
        return callback_handler(eval(matches.groups()[0]))
 

	
 
_meta = open(os.path.join(here, 'kallithea', '__init__.py'), 'rb')
 
_metadata = _meta.read()
 
_meta.close()
 

	
 
callback = lambda V: ('.'.join(map(str, V[:3])) + '.'.join(V[3:]))
 
__version__ = _get_meta_var('VERSION', _metadata, callback)
 
__license__ = _get_meta_var('__license__', _metadata)
 
__author__ = _get_meta_var('__author__', _metadata)
 
__url__ = _get_meta_var('__url__', _metadata)
 
# defines current platform
 
__platform__ = platform.system()
 

	
 
is_windows = __platform__ in ['Windows']
 

	
 
requirements = [
 
    "alembic>=0.8.0,<0.9",
 
    "waitress==0.8.8",
 
    "webob>=1.0.8,<=1.1.1",
 
    "webtest==1.4.3",
 
    "Pylons>=1.0.0,<=1.0.2",
 
    "Beaker==1.6.4",
 
    "WebHelpers==1.3",
 
    "formencode>=1.2.4,<=1.2.6",
 
    "SQLAlchemy>=1.0,<1.1",
 
    "Mako>=0.9.0,<=1.0.0",
 
    "pygments>=1.5",
 
    "whoosh>=2.4.0,<=2.5.7",
 
    "celery>=2.2.5,<2.3",
 
    "babel>=0.9.6,<=1.3",
 
    "python-dateutil>=1.5.0,<2.0.0",
 
    "markdown==2.2.1",
 
    "docutils>=0.8.1,<=0.11",
 
    "mock",
 
    "URLObject==2.3.4",
 
    "Routes==1.13",
 
    "pytest>=2.7.0,<3.0",
 
    "pytest-sugar>=0.7.0,<1.0.0",
 
    "dulwich>=0.14.1",
 
    "mercurial>=2.9,<3.9",
 
]
 

	
 
if sys.version_info < (2, 7):
 
    requirements.append("importlib==1.0.1")
 
    requirements.append("unittest2")
 
    requirements.append("argparse")
 

	
 
if not is_windows:
 
    requirements.append("bcrypt>=2.0.0")
 

	
 

	
 
dependency_links = [
 
]
 

	
 
classifiers = [
 
    'Development Status :: 4 - Beta',
 
    'Environment :: Web Environment',
 
    'Framework :: Pylons',
 
    'Intended Audience :: Developers',
 
    'License :: OSI Approved :: GNU General Public License (GPL)',
 
    'Operating System :: OS Independent',
 
    'Programming Language :: Python',
 
    'Programming Language :: Python :: 2.6',
 
    'Programming Language :: Python :: 2.7',
 
    'Topic :: Software Development :: Version Control',
 
]
 

	
 

	
 
# additional files from project that goes somewhere in the filesystem
 
# relative to sys.prefix
 
data_files = []
 

	
 
description = ('Kallithea is a fast and powerful management tool '
 
               'for Mercurial and Git with a built in push/pull server, '
 
               'full text search and code-review.')
 
@@ -126,51 +120,49 @@ except ImportError:
 
from setuptools.command import sdist
 
sdist_org = sdist.sdist
 
class sdist_new(sdist_org):
 
    def initialize_options(self):
 
        sdist_org.initialize_options(self)
 
        self.owner = self.group = 'root'
 
sdist.sdist = sdist_new
 

	
 
# packages
 
packages = find_packages(exclude=['ez_setup'])
 

	
 
setup(
 
    name='Kallithea',
 
    version=__version__,
 
    description=description,
 
    long_description=long_description,
 
    keywords=keywords,
 
    license=__license__,
 
    author=__author__,
 
    author_email='kallithea@sfconservancy.org',
 
    dependency_links=dependency_links,
 
    url=__url__,
 
    install_requires=requirements,
 
    classifiers=classifiers,
 
    setup_requires=['PasteScript>=1.6.3',
 
                    'pytest-runner'],
 
    tests_require=['pytest'],
 
    setup_requires=['PasteScript>=1.6.3'],
 
    data_files=data_files,
 
    packages=packages,
 
    include_package_data=True,
 
    message_extractors={'kallithea': [
 
            ('**.py', 'python', None),
 
            ('templates/**.mako', 'mako', {'input_encoding': 'utf-8'}),
 
            ('templates/**.html', 'mako', {'input_encoding': 'utf-8'}),
 
            ('public/**', 'ignore', None)]},
 
    zip_safe=False,
 
    paster_plugins=['PasteScript', 'Pylons'],
 
    entry_points="""
 
    [console_scripts]
 
    kallithea-api =    kallithea.bin.kallithea_api:main
 
    kallithea-gist =   kallithea.bin.kallithea_gist:main
 
    kallithea-config = kallithea.bin.kallithea_config:main
 

	
 
    [paste.app_factory]
 
    main = kallithea.config.middleware:make_app
 

	
 
    [paste.app_install]
 
    main = pylons.util:PylonsInstaller
 

	
 
    [paste.global_paster_command]
 
    setup-db=kallithea.lib.paster_commands.setup_db:Command
tox.ini
Show inline comments
 
[tox]
 
minversion = 1.8
 
envlist = py{26,27}-pytest
 

	
 
[testenv]
 
setenv =
 
    PYTHONHASHSEED = 0
 
deps =
 
    pytest: pytest
 
    -r{toxinidir}/dev_requirements.txt
 
    py26-pytest: unittest2
 
    python-ldap
 
    python-pam
 
commands =
 
    pytest: py.test {posargs}
0 comments (0 inline, 0 general)