Skip to content

Commit

Permalink
Try to isolate tests and make them run
Browse files Browse the repository at this point in the history
  • Loading branch information
solarkennedy committed Sep 25, 2015
1 parent a137ba3 commit 5aba46d
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 9 deletions.
57 changes: 57 additions & 0 deletions .gitignore
@@ -1 +1,58 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -2,4 +2,4 @@ language: python
python:
- "2.6"
- "2.7"
script: nosetests --with-scriptloader sensu-report
script: py.test
8 changes: 0 additions & 8 deletions sensu-report
Expand Up @@ -11,7 +11,6 @@ from optparse import OptionParser
import re
import socket
import sys
import time
import urllib2


Expand Down Expand Up @@ -106,13 +105,6 @@ def fetch_silence_data(server, port, client, username, password):
return data


def test_pretty_date():
""" Lets put in some epochs we expect from sensu and make sure it is pretty
"""
fakenow = int(time.time()-5)
assert pretty_date(fakenow) == "Just now"


def pretty_date(time=False):
""" Get a datetime object or a int() Epoch timestamp and return a pretty
string like 'an hour ago', 'Yesterday', '3 months ago', 'just now', etc """
Expand Down
1 change: 1 addition & 0 deletions sensu_report.py
10 changes: 10 additions & 0 deletions test_sensu-report.py
@@ -0,0 +1,10 @@
#!/usr/bin/env python
import time

import sensu_report

def test_pretty_date():
""" Lets put in some epochs we expect from sensu and make sure it is pretty
"""
fakenow = int(time.time()-5)
assert sensu_report.pretty_date(fakenow) == "just now"

0 comments on commit 5aba46d

Please sign in to comment.