Merge pull request #821 from AndreMiras/feature/ticket813_buildozer_help_crashes

Unit tests buildozer --help command, refs #813
This commit is contained in:
Alexander Taylor 2019-02-08 19:56:32 +00:00 committed by GitHub
commit 197be74037
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 0 deletions

View file

@ -1225,4 +1225,5 @@ class TargetAndroid(Target):
def get_target(buildozer):
buildozer.targetname = "android"
return TargetAndroid(buildozer)

View file

@ -1,7 +1,9 @@
import os
import mock
import unittest
import buildozer as buildozer_module
from buildozer import Buildozer
from six import StringIO
class TestBuildozer(unittest.TestCase):
@ -24,3 +26,13 @@ class TestBuildozer(unittest.TestCase):
'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())

View file

@ -2,6 +2,7 @@
envlist = pep8,py27,py36
[testenv]
deps = mock
commands =
python -m unittest discover --top-level-directory=. --start-directory=tests/