Skip to content

Commit

Permalink
add minimal tests
Browse files Browse the repository at this point in the history
  • Loading branch information
erral committed Sep 5, 2018
1 parent bd1a77f commit 7600025
Show file tree
Hide file tree
Showing 6 changed files with 211 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[report]
include =
fidetournament/*
omit =
tests/*
22 changes: 22 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Config file for automatic testing at travis-ci.org

language: python
python:
- 3.6
- 3.5
- 3.4
- 2.7

# Command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install:
- pip install -U tox-travis
- pip install -U coveralls

# Command to run tests, e.g. python setup.py test
script:
- tox
- coverage run setup.py test
- coverage report -m

after_success:
- coveralls
Empty file added tests/__init__.py
Empty file.
150 changes: 150 additions & 0 deletions tests/test_demo.trf

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from fidetournament.tournament import Tournament

import os
import unittest

class TestTournament(unittest.TestCase):

def build_path_to_file(self, filepath):
return os.path.join(os.path.dirname(os.path.realpath(__file__)), filepath)

def test_parse(self):
t = Tournament()
t.parse(self.build_path_to_file('test_demo.trf'))
self.assertNotEqual(len(t.players), 0)
20 changes: 20 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[tox]
envlist = py27, py34, py35, py36, flake8

[travis]
python =
3.6: py36
3.5: py35
3.4: py34
2.7: py27

[testenv:flake8]
basepython = python
deps = flake8
commands = flake8 fidetournament

[testenv]
setenv =
PYTHONPATH = {toxinidir}

commands = python setup.py test

0 comments on commit 7600025

Please sign in to comment.