Skip to content

Using py.test instead of nose #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@ before_install:
- wget http://bit.ly/miniconda -O miniconda.sh
- bash miniconda.sh -b -p $HOME/miniconda
- export PATH="$HOME/miniconda/bin:$PATH"
- conda update --yes conda
- travis_retry conda create --yes -n test $CONDA pip jinja2 pandas mock six nose
- conda update --yes --all
- travis_retry conda create --yes -n test $CONDA --file requirements.txt
- source activate test
- travis_retry conda install --yes pip mock pytest pandas
- travis_retry pip install vincent

install:
- python setup.py install

script:
- cd tests && nosetests --verbose --nocapture folium_tests.py
- python setup.py test

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Jinja2==2.7.2
Jinja2
68 changes: 38 additions & 30 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,40 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import

import os
import re
import sys
import codecs
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
from setuptools import setup
from setuptools.command.test import test as TestCommand

rootpath = os.path.abspath(os.path.dirname(__file__))


class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
# FIXME: '--doctest-modules'
self.test_args = ['--verbose']
self.test_suite = True

def run_tests(self):
import pytest
errno = pytest.main(self.test_args)
sys.exit(errno)


def read(*parts):
return codecs.open(os.path.join(rootpath, *parts), 'r').read()
return open(os.path.join(rootpath, *parts), 'r').read()


def find_version(*file_paths):
version_file = read(*file_paths)
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
version_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
def extract_version(module='folium'):
version = None
fname = os.path.join(rootpath, module, '__init__.py')
with open(fname) as f:
for line in f:
if (line.startswith('__version__')):
_, version = line.split('=')
version = version.strip()[1:-1] # Remove quotation characters.
break
return version


def walk_subpkg(name):
Expand All @@ -47,20 +57,23 @@ def walk_subpkg(name):
'templates/*.js',
'templates/*.txt'] + walk_subpkg('templates/tiles')}
pkgs = ['folium',
'folium.plugins',
]
'folium.plugins']

LICENSE = read('LICENSE.txt')
version = find_version('folium', '__init__.py')
long_description = '{}\n{}'.format(read('README.rst'), read('CHANGES.txt'))

# Dependencies.
with open('requirements.txt') as f:
tests_require = f.readlines()
install_requires = [t.strip() for t in tests_require]


config = dict(name='folium',
version=version,
version=extract_version(),
description='Make beautiful maps with Leaflet.js & Python',
long_description=long_description,
author='Rob Story',
author_email='[email protected]',
license='MIT License',
url='https://github.com/python-visualization/folium',
keywords='data visualization',
classifiers=['Development Status :: 4 - Beta',
Expand All @@ -70,16 +83,11 @@ def walk_subpkg(name):
'License :: OSI Approved :: MIT License'],
packages=pkgs,
package_data=pkg_data,
cmdclass=dict(test=PyTest),
tests_require=['pytest'],
license=LICENSE,
install_requires=install_requires,
zip_safe=False)


if sys.argv[-1] == 'publish':
os.system("python setup.py sdist upload")
print("Remember to also tag the version.")
sys.exit()
elif sys.argv[-1] == 'tag':
os.system("git tag -a %s -m 'version %s'" % (version, version))
os.system("git push --tags")
sys.exit()

setup(**config)
Loading