Skip to content
This repository has been archived by the owner on Jan 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #69 from antonagestam/tox-tests-squashed
Browse files Browse the repository at this point in the history
run tests using tox
  • Loading branch information
antonagestam committed Jan 6, 2016
2 parents 53a95d2 + 4c8f3e4 commit 46321c4
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 42 deletions.
42 changes: 20 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
language: python
python:
- "2.7"
- "3.2"
- "3.3"
- "3.4"
env:
- DJANGO_VERSION=1.4.20
- DJANGO_VERSION=1.7.7
- DJANGO_VERSION=1.8
install:
- pip install -r test-requirements.txt
- pip install -q Django==$DJANGO_VERSION
script: "coverage run --source=collectfast ./runtests.py"
after_success:
coveralls
matrix:
exclude:
- python: "3.2"
env: DJANGO_VERSION=1.4.20
- python: "3.3"
env: DJANGO_VERSION=1.4.20
- python: "3.4"
env: DJANGO_VERSION=1.4.20
- pip install tox
script: tox
sudo: false
env:
matrix:
- TOXENV=py27-django18
- TOXENV=py27-django19
- TOXENV=py33-django18
- TOXENV=py34-django18
- TOXENV=py34-django19
- TOXENV=py35-django18
- TOXENV=py35-django19
- TOXENV=flake8
# work-around for Python 3.5
addons:
apt:
sources:
- deadsnakes
packages:
- python3.5
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
test:
python runtests.py

distribute:
python setup.py sdist bdist_wheel upload
24 changes: 9 additions & 15 deletions collectfast/management/commands/collectstatic.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-

from __future__ import with_statement, unicode_literals
from optparse import make_option
import hashlib
import datetime

Expand All @@ -15,7 +14,7 @@
try:
from django.utils.six.moves import input as _input
except ImportError:
_input = raw_input
_input = raw_input # noqa


collectfast_cache = getattr(settings, "COLLECTFAST_CACHE", "default")
Expand All @@ -34,8 +33,11 @@ class Command(collectstatic.Command):

def add_arguments(self, parser):
super(Command, self).add_arguments(parser)
parser.add_argument('--ignore-etag',
action='store_true', dest='ignore_etag', default=False,
parser.add_argument(
'--ignore-etag',
action='store_true',
dest='ignore_etag',
default=False,
help="Disable Collectfast.")

def __init__(self, *args, **kwargs):
Expand Down Expand Up @@ -146,7 +148,7 @@ def delete_file(self, path, prefixed_path, source_storage):
"""Override delete_file to skip modified time and exists lookups"""
if not self.collectfast_enabled:
return super(Command, self).delete_file(
path, prefixed_path, source_storage)
path, prefixed_path, source_storage)
if self.dry_run:
self.log("Pretending to delete '%s'" % path)
else:
Expand Down Expand Up @@ -178,8 +180,8 @@ def handle_noargs(self, **options):
%s
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: """
% (destination_display, clear_display))
Type 'yes' to continue, or 'no' to cancel: """ % (
destination_display, clear_display))
if confirm != 'yes':
raise CommandError("Collecting static files cancelled.")

Expand Down Expand Up @@ -208,11 +210,3 @@ def handle_noargs(self, **options):
'collect_time': self.collect_time,
}
self.stdout.write(smart_str(summary))


if VERSION < (1, 8):
Command.option_list = collectstatic.Command.option_list + (
make_option(
'--ignore-etag', action="store_true", dest="ignore_etag",
default=False, help="Disable Collectfast."),
)
2 changes: 0 additions & 2 deletions collectfast/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
from .test_command import (
TestCommand, TestCopyFile, TestGetFileHash, TestAwsPreloadMetadata)
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
max-line-length = 120
ignore = F403,E265
exclude = .git
max-complexity = 12
3 changes: 0 additions & 3 deletions test-requirements.txt

This file was deleted.

16 changes: 16 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[tox]
envlist = py{27,33,34,35}-django{18,19}
[testenv]
deps =
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
mock==1.3.0
coveralls
commands =
coverage run --source=collectfast {toxinidir}/runtests.py
- coveralls
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
[testenv:flake8]
basepython = python
deps = flake8
commands = flake8 collectfast

0 comments on commit 46321c4

Please sign in to comment.