Skip to content

Commit

Permalink
add travis.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
olt committed Sep 6, 2012
1 parent 6aa3ca6 commit 3e83d22
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 12 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
@@ -0,0 +1,15 @@
language: python
python:
- "2.5"
- "2.6"
- "2.7"
services:
- couchdb
# command to install dependencies
install:
- "if [[ $TRAVIS_PYTHON_VERSION == '2.5' ]]; then pip install --use-mirrors multiprocessing; fi"
- "if [[ $TRAVIS_PYTHON_VERSION != '2.5' ]]; then pip install requests==0.14.0; export MAPPROXY_TEST_COUCHDB=http://127.0.0.1:5984; fi"
- "sudo apt-get install libproj0 libgeos-dev libgdal-dev libxslt1-dev libxml2-dev build-essential python-dev libjpeg-dev zlib1g-dev libfreetype6-dev"
- "pip install -r requirements-travis.txt --use-mirrors"
# command to run tests
script: nosetests
24 changes: 13 additions & 11 deletions mapproxy/util/__init__.py
@@ -1,12 +1,12 @@
# This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -30,7 +30,7 @@
def local_base_config(conf):
"""
Temporarily set the global configuration (mapproxy.config.base_config).
The global mapproxy.config.base_config object is thread-local and
is set per-request in the MapProxyApp. Use `local_base_config` to
set base_config outside of a request context (e.g. system loading
Expand Down Expand Up @@ -97,9 +97,9 @@ def swap_dir(src_dir, dst_dir, keep_old=False, backup_ext='.tmp'):
tmp_dir = dst_dir + backup_ext
if os.path.exists(dst_dir):
os.rename(dst_dir, tmp_dir)

_force_rename_dir(src_dir, dst_dir)

if os.path.exists(tmp_dir) and not keep_old:
shutil.rmtree(tmp_dir)

Expand Down Expand Up @@ -139,8 +139,10 @@ def timestamp_before(weeks=0, days=0, hours=0, minutes=0):

def timestamp_from_isodate(isodate):
"""
>>> timestamp_from_isodate('2009-06-09T10:57:00')
1244537820.0
>>> ts = timestamp_from_isodate('2009-06-09T10:57:00')
>>> # we don't know which timezone the test will run
>>> (1244537820.0 - 14 * 3600) < ts < (1244537820.0 + 14 * 3600)
True
>>> timestamp_from_isodate('2009-06-09T10:57') #doctest: +ELLIPSIS
Traceback (most recent call last):
...
Expand All @@ -152,7 +154,7 @@ def timestamp_from_isodate(isodate):
date = datetime.datetime.strptime(isodate, "%Y-%m-%dT%H:%M:%S")
return time.mktime(date.timetuple())

def cleanup_directory(directory, before_timestamp, remove_empty_dirs=True,
def cleanup_directory(directory, before_timestamp, remove_empty_dirs=True,
file_handler=None):
if file_handler is None:
file_handler = os.remove
Expand All @@ -173,7 +175,7 @@ def cleanup_directory(directory, before_timestamp, remove_empty_dirs=True,

if remove_empty_dirs:
remove_dir_if_emtpy(dirpath)

if remove_empty_dirs:
remove_dir_if_emtpy(directory)

Expand All @@ -199,7 +201,7 @@ def ensure_directory(file_name):
def replace_instancemethod(old_method, new_method):
"""
Replace an instance method.
>>> class Foo(object):
... val = 'bar'
... def bar(self):
Expand Down
3 changes: 2 additions & 1 deletion requirements-tests.txt
@@ -1,4 +1,5 @@
WebTest>=1.2.2
WebTest>=1.2.2,<1.2.99
webob==1.1.1
coverage>=2.85
lxml>=2.1.3
mocker>=0.10.1
Expand Down
9 changes: 9 additions & 0 deletions requirements-travis.txt
@@ -0,0 +1,9 @@
WebTest==1.4.0
webob==1.1.1
lxml==2.3.5
mocker==1.1.1
nose==1.1.2
Shapely==1.2.15
PyYAML==3.10
Pillow==1.7.7
eventlet==0.9.17

0 comments on commit 3e83d22

Please sign in to comment.