buildozer/tests/test_buildozer.py
Andre Miras 0d22e60e2e Unit tests buildozer --help command, refs #813
This test should fail due to #813. Next commit will fix it.
2019-02-08 18:53:34 +01:00

38 lines
1.2 KiB
Python

import os
import mock
import unittest
import buildozer as buildozer_module
from buildozer import Buildozer
from six import StringIO
class TestBuildozer(unittest.TestCase):
def test_buildozer_base(self):
"""
Basic test making sure the Buildozer object can be instanciated.
"""
buildozer = Buildozer()
self.assertEqual(buildozer.specfilename, 'buildozer.spec')
# spec file doesn't have to exist
self.assertFalse(os.path.exists(buildozer.specfilename))
def test_buildozer_read_spec(self):
"""
Initializes Buildozer object from existing spec file.
"""
specfilepath = os.path.join(
os.path.dirname(buildozer_module.__file__),
'default.spec')
buildozer = Buildozer(filename=specfilepath)
self.assertTrue(os.path.exists(buildozer.specfilename))
def test_buildozer_help(self):
"""
Makes sure the help gets display with no error, refs:
https://github.com/kivy/buildozer/issues/813
"""
buildozer = Buildozer()
with mock.patch('sys.stdout', new_callable=StringIO) as mock_stdout:
buildozer.usage()
self.assertIn('Usage:', mock_stdout.getvalue())