Skip to content

Commit a5bb61d

Browse files
author
Devyn Stott
committed
test(): Add some BAT and unit tests
1 parent 3a969a4 commit a5bb61d

5 files changed

Lines changed: 53 additions & 6 deletions

File tree

requirements.txt

Whitespace-only changes.

setup.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# -*- coding: utf-8 -*-
2-
3-
4-
"""setup.py: setuptools control."""
2+
#
3+
# Copyright (c) 2017 <company or person>
4+
#
5+
"""
6+
setup.py: For installing via pip
7+
"""
58

69
import re
710
from setuptools import setup, find_packages
@@ -14,10 +17,16 @@
1417

1518
setup(
1619
name="python-starter",
17-
packages=find_packages(),
20+
version=version,
21+
description="Python command line application targeted toward open source best practices.",
22+
packages=find_packages(exclude=['docs', 'tests*']),
23+
install_requires=[],
1824
entry_points={
1925
"console_scripts": ['start_example = starter.__main__:main']
2026
},
21-
version=version,
22-
description="Python command line application bare bones template."
27+
test_suite='tests',
28+
tests_require=['coverage',
29+
'pytest',
30+
'pylint',
31+
'mock']
2332
)

starter/test/test_starter.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright (c) 2017 <company or person>
4+
#
5+
import unittest
6+
from starter import StartExample
7+
8+
9+
class TestStarter(unittest.TestCase):
10+
11+
def setUp(self):
12+
self.start_example = StartExample()
13+
14+
def test_run(self):
15+
self.start_example.run()
16+
17+
def test_version(self):
18+
self.start_example.print_version()

tests/__init__.py

Whitespace-only changes.

tests/test_command_line.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# Copyright (c) 2017 <company or person>
4+
#
5+
import unittest
6+
import subprocess
7+
import os
8+
from starter import StartExample
9+
10+
11+
class TestStarter(unittest.TestCase):
12+
13+
def setUp(self):
14+
self.command = ['start_example']
15+
16+
def test_run(self):
17+
pipe = subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
18+
stdout, stderr = pipe.communicate()
19+
print(stdout)
20+
self.assertEquals(stdout.splitlines(), "Version: 0.2.0\nHello World!\n".splitlines())

0 commit comments

Comments
 (0)