Skip to content

Commit

Permalink
Merge pull request #46 from Kentzo/tests
Browse files Browse the repository at this point in the history
Add tests and travis integrations
  • Loading branch information
Kentzo authored Aug 13, 2018
2 parents 7e50503 + dccfdaf commit 5aa6261
Show file tree
Hide file tree
Showing 5 changed files with 468 additions and 2 deletions.
198 changes: 198 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
env:
global:
- PIP_URL="https://bootstrap.pypa.io/get-pip.py"
- PIP="python -m pip"

matrix:
fast_finish: true
include:
- os: osx
language: generic
env:
- NAME="Python 2.6"
- PIP_URL="https://bootstrap.pypa.io/2.6/get-pip.py"
- PIP=pip
before_install:
- brew update
- brew upgrade pyenv || brew install pyenv || true
- pyenv install 2.6.9
- pyenv local 2.6.9
- eval "$(pyenv init -)"
- pip install virtualenv
- python2.6 -m virtualenv env
- pyenv local --unset
- source env/bin/activate
- os: osx
language: generic
env: NAME="Python 2.7"
before_install:
- brew update
- brew upgrade python2 || true
- python2.7 -m pip install virtualenv
- python2.7 -m virtualenv env
- source env/bin/activate
- os: osx
language: generic
env: NAME="Python pypy"
before_install:
- brew update
- brew upgrade pypy || brew install pypy || true
- pypy -m pip install virtualenv
- pypy -m virtualenv env
- source env/bin/activate
- os: osx
language: generic
env: NAME="Python 3.4"
before_install:
- brew update
- brew upgrade pyenv || brew install pyenv || true
- pyenv install 3.4.9
- pyenv local 3.4.9
- eval "$(pyenv init -)"
- python3.4 -m venv env
- pyenv local --unset
- source env/bin/activate
- os: osx
language: generic
env: NAME="Python 3.5"
before_install:
- brew update
- brew upgrade pyenv || brew install pyenv || true
- pyenv install 3.5.6
- pyenv local 3.5.6
- eval "$(pyenv init -)"
- python3.5 -m venv env
- pyenv local --unset
- source env/bin/activate
- os: osx
language: generic
env: NAME="Python 3.6"
before_install:
- brew update
- brew upgrade pyenv || brew install pyenv || true
- pyenv install 3.6.6
- pyenv local 3.6.6
- eval "$(pyenv init -)"
- python3.6 -m venv env
- pyenv local --unset
- source env/bin/activate
- os: osx
language: generic
env: NAME="Python 3.7"
before_install:
- brew update
- brew upgrade python || true
- python3.7 -m venv env
- source env/bin/activate
- os: osx
language: generic
env: NAME="Python HEAD"
before_install:
- brew update
- brew unlink python
- brew install python --HEAD
- python3 -m venv env
- source env/bin/activate
- os: osx
language: generic
env: NAME="Python pypy3"
before_install:
- brew update
- brew upgrade pypy3 || brew install pypy3 || true
- pypy3 -m venv env
- source env/bin/activate
- os: linux
env:
- PIP_URL="https://bootstrap.pypa.io/2.6/get-pip.py"
- PIP=env/bin/pip
language: python
python: 2.6
before_install:
- pip install virtualenv
- python2.6 -m virtualenv env
- source env/bin/activate
- os: linux
language: python
python: 2.7
before_install:
- pip install virtualenv
- python2.7 -m virtualenv env
- source env/bin/activate
- os: linux
language: python
python: pypy
before_install:
- pip install virtualenv
- pypy -m virtualenv env
- source env/bin/activate
- os: linux
language: python
python: 3.4
before_install:
- python3.4 -m venv env
- source env/bin/activate
- os: linux
language: python
python: 3.5
before_install:
- python3.5 -m venv env
- source env/bin/activate
- os: linux
language: python
python: 3.6
before_install:
- python3.6 -m venv env
- source env/bin/activate
- os: linux
language: python
python: &python_major_ver 3.7
dist: xenial
sudo: true
before_install:
- python3.7 -m venv env
- source env/bin/activate
- os: linux
language: python
python: 3.6-dev
before_install:
- python3.6 -m venv env
- source env/bin/activate
- os: linux
language: python
python: 3.7-dev
before_install:
- python3.7 -m venv env
- source env/bin/activate
- os: linux
language: python
python: nightly
before_install:
- python3 -m venv env
- source env/bin/activate
- os: linux
language: python
python: pypy3
before_install:
- pypy3 -m venv env
- source env/bin/activate
allow_failures:
- os: osx
env: NAME="Python HEAD"
- os: linux
python: 3.6-dev
- os: linux
python: 3.7-dev
- os: linux
python: nightly

install:
- which python
- ls env/bin
- curl ${PIP_URL} | python
- ${PIP} install -r requirements.txt

script:
- python setup.py test

after_success:
- python -m codecov
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pytest==3.7.1; python_version>"2.6"
pytest==3.2.5; python_version<="2.6"
pytest-cov==2.5.1
codecov==2.0.15
15 changes: 14 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,30 @@ author_email = [email protected]
url = https://github.com/Kentzo/git-archive-all
description = Archive git repository with its submodules.
license = MIT License
license_file = LICENSE.txt
classifiers =
Development Status :: 5 - Production/Stable
Environment :: Console
Intended Audience :: Developers
Intended Audience :: System Administrators
License :: OSI Approved :: MIT License
Natural Language :: English
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3.4
Programming Language :: Python :: 3.5
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Topic :: Software Development :: Version Control
Topic :: System :: Archiving
platforms = any
long_description = file: README.rst

[options]
zip_safe = 1
python_requires = >=2.6,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,

[tool:pytest]
addopts= --cov=git_archive_all --cov-report=term --cov-report=html --cov-branch
25 changes: 24 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import re
import sys

from setuptools import setup
from setuptools.command.test import test as TestCommand

# Parse the version from the file.
verstrline = open('git_archive_all.py', "rt").read()
Expand All @@ -10,8 +13,28 @@
else:
raise RuntimeError("Unable to find version string in git_archive_all.py")


class PyTest(TestCommand):
user_options = [("pytest-args=", "a", "Arguments to pass to pytest")]

def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = ""

def run_tests(self):
import shlex

# import here, cause outside the eggs aren't loaded
import pytest

errno = pytest.main(shlex.split(self.pytest_args))
sys.exit(errno)


setup(
version=verstr,
py_modules=['git_archive_all'],
entry_points={'console_scripts': 'git-archive-all=git_archive_all:main'}
entry_points={'console_scripts': 'git-archive-all=git_archive_all:main'},
tests_require=['pytest', 'pytest-cov'],
cmdclass={"test": PyTest},
)
Loading

0 comments on commit 5aa6261

Please sign in to comment.