Skip to content
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

Implement unit testing by means of Tox #172

Closed
wants to merge 8 commits into from
Closed
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
47 changes: 39 additions & 8 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,43 @@
language: python
python:
- "2.6"
- "2.7"
- "pypy"
sudo: false

matrix:
include:
- env: TOXENV=coveralls
python: "2.7"
- env: TOXENV=py26-twisted12
python: "2.6"
- env: TOXENV=py26-twisted13
python: "2.6"
- env: TOXENV=py26-twisted14
python: "2.6"
- env: TOXENV=py26-twisted15
python: "2.6"
- env: TOXENV=py27-twisted12
python: "2.7"
- env: TOXENV=py27-twisted13
python: "2.7"
- env: TOXENV=py27-twisted14
python: "2.7"
- env: TOXENV=py27-twisted15
python: "2.7"
- env: TOXENV=py35-twisted15
python: "3.5"
- env: TOXENV=pypy-twisted12
python: "pypy"
- env: TOXENV=pypy-twisted13
python: "pypy"
- env: TOXENV=pypy-twisted14
python: "pypy"
- env: TOXENV=pypy-twisted15
python: "pypy"
- env: TOXENV=pypy3-twisted15
python: "pypy3"
allow_failures:
- env: TOXENV=py35-twisted15
- env: TOXENV=pypy3-twisted15

install:
- pip install -r cyclone/tests/test_requirements.txt
- pip install coveralls
- pip install tox

script: coverage run `which trial` cyclone
after_success: coveralls
script: tox
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Cyclone
=======
[![Build Status](https://secure.travis-ci.org/fiorix/cyclone.png?branch=master)](https://travis-ci.org/fiorix/cyclone) [![Coverage Status](https://coveralls.io/repos/evilaliv3/cyclone/badge.svg?branch=tox)](https://coveralls.io/r/evilaliv3/cyclone?branch=tos)

Cyclone is a web server framework for Python, that implements the Tornado API
as a Twisted protocol.

Expand Down
2 changes: 1 addition & 1 deletion cyclone/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def test_object_dict(self):
def test_import_object(self):
import os.path
other_os = import_object("os.path")
self.assertIs(os.path, other_os)
self.assertIdentical(os.path, other_os)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is assertIdentical in python 2.7 @evilaliv3 ?


def test_import_object_fail(self):
self.assertRaises(ImportError, import_object, "meowkittens.something")
Expand Down
8 changes: 2 additions & 6 deletions cyclone/tests/test_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,8 @@ def test_set_cookie_expires_days(self):
self.rh.set_cookie("name", "value", expires_days=5, max_age=55)
expires = self.rh._new_cookie["name"]['expires']
self.assertTrue(
expires >
email.utils.formatdate(
calendar.timegm(time.gmtime()),
localtime=False,
usegmt=True
)
email.utils.parsedate(expires) >
time.gmtime(),
)

def test_clear_cookie(self):
Expand Down
140 changes: 140 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
; tox configuration file for running tests similar to buildbot builders.

[tox]
envlist =
coveralls
py26-twisted12
py26-twisted13
py26-twisted14
py26-twisted15
py27-twisted12
py27-twisted13
py27-twisted14
py27-twisted15
py35-twisted15
pypy-twisted12
pypy-twisted13
pypy-twisted14
pypy-twisted15
pypy3-twisted15

[testenv]
commands =
coverage erase
coverage run --source=./cyclone {envbindir}/trial --rterrors {posargs:cyclone}
coverage report -m

[testenv:coveralls]
passenv = TRAVIS TRAVIS_JOB_ID TRAVIS_BRANCH
deps =
coverage
coveralls
mock
twisted>=15.0, <16.0
commands =
coverage erase
coverage run --source=./cyclone {envbindir}/trial --rterrors {posargs:cyclone}
coverage report -m
coveralls

[testenv:py26-twisted12]
deps =
coverage
mock
twisted>=12.0, <13.0

[testenv:py26-twisted13]
deps =
coverage
mock
twisted>=13.0, <14.0

[testenv:py26-twisted14]
deps =
coverage
mock
twisted>=14.0, <15.0

[testenv:py26-twisted15]
deps =
coverage
mock
twisted>=15.0, <15.5

[testenv:py27-twisted12]
deps =
coverage
mock
twisted>=12.0, <13.0

[testenv:py27-twisted13]
deps =
coverage
mock
twisted>=13.0, <14.0

[testenv:py27-twisted14]
deps =
coverage
mock
twisted>=14.0, <15.0

[testenv:py27-twisted15]
deps =
coverage
mock
twisted>=15.0, <16.0

[testenv:py35-twisted12]
deps =
coverage
mock
twisted>=12.0, <13.0

[testenv:py35-twisted13]
deps =
coverage
mock
twisted>=13.0, <14.0

[testenv:py35-twisted14]
deps =
coverage
mock
twisted>=14.0, <15.0

[testenv:py35-twisted15]
deps =
coverage
mock
twisted>=15.0, <16.0

[testenv:pypy-twisted12]
deps =
coverage
mock
twisted>=12.0, <13.0

[testenv:pypy-twisted13]
deps =
coverage
mock
twisted>=13.0, <14.0

[testenv:pypy-twisted14]
deps =
coverage
mock
twisted>=14.0, <15.0

[testenv:pypy-twisted15]
deps =
coverage
mock
twisted>=15.0, <16.0

[testenv:pypy3-twisted15]
deps =
coverage
mock
twisted>=15.0, <16.0