Added unit test.
This commit is contained in:
15
.travis.yml
Normal file
15
.travis.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
sudo: false
|
||||||
|
language: python
|
||||||
|
cache: pip
|
||||||
|
python:
|
||||||
|
- "2.7"
|
||||||
|
- "3.4"
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- pip install codecov
|
||||||
|
|
||||||
|
script:
|
||||||
|
- coverage run tests.py
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- codecov
|
||||||
33
tests.py
Normal file
33
tests.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
"""Installer unit tests."""
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
import run
|
||||||
|
|
||||||
|
|
||||||
|
class ConfigFileTestCase(unittest.TestCase):
|
||||||
|
"""Test configuration file generation."""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
"""Create temp dir."""
|
||||||
|
self.workdir = tempfile.mkdtemp()
|
||||||
|
self.cfgfile = os.path.join(self.workdir, "installer.cfg")
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
"""Delete temp dir."""
|
||||||
|
shutil.rmtree(self.workdir)
|
||||||
|
|
||||||
|
def test_configfile_generation(self):
|
||||||
|
"""Check simple case."""
|
||||||
|
run.main([
|
||||||
|
"--stop-after-configfile-check",
|
||||||
|
"--configfile", self.cfgfile,
|
||||||
|
"example.test"])
|
||||||
|
self.assertTrue(os.path.exists(self.cfgfile))
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
||||||
Reference in New Issue
Block a user