Skip to content

Commit

Permalink
remove version argument
Browse files Browse the repository at this point in the history
  • Loading branch information
craigahobbs committed Jul 22, 2021
1 parent 9037516 commit d3c59cb
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 27 deletions.
7 changes: 1 addition & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Licensed under the MIT License
# https://github.com/craigahobbs/unittest-parallel/blob/main/LICENSE

import re
import os

from setuptools import setup
Expand All @@ -10,10 +9,6 @@
PACKAGE_NAME = 'unittest-parallel'

def main():
# Read the package version
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'src', MODULE_NAME, '__init__.py'), encoding='utf-8') as init_file:
version = re.search(r"__version__ = '(.+?)'", init_file.read()).group(1)

# Read the readme for use as the long description
with open(os.path.join(os.path.abspath(os.path.dirname(__file__)), 'README.md'), encoding='utf-8') as readme_file:
long_description = readme_file.read()
Expand All @@ -24,7 +19,7 @@ def main():
description='Parallel unit test runner with coverage support',
long_description=long_description,
long_description_content_type='text/markdown',
version=version,
version='1.4.2',
author='Craig Hobbs',
author_email='craigahobbs@gmail.com',
keywords='test unittest coverage parallel',
Expand Down
11 changes: 0 additions & 11 deletions src/tests/test_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import unittest
from unittest.mock import ANY, Mock, call, patch

from unittest_parallel import __version__
import unittest_parallel.__main__
from unittest_parallel.main import main

Expand Down Expand Up @@ -149,16 +148,6 @@ def assert_output(self, actual, expected):
def test_module_main(self):
self.assertTrue(unittest_parallel.__main__)

def test_version(self):
with patch('sys.stdout', StringIO()) as stdout, \
patch('sys.stderr', StringIO()) as stderr:
with self.assertRaises(SystemExit) as cm_exc:
main(['--version'])

self.assertEqual(cm_exc.exception.code, 0)
self.assertEqual(stdout.getvalue(), '')
self.assertEqual(stderr.getvalue(), str(__version__) + '\n')

def test_jobs(self):
with patch('multiprocessing.cpu_count', Mock(return_value=1)) as cpu_count_mock, \
patch('multiprocessing.Pool', new=MockMultiprocessingPool), \
Expand Down
4 changes: 0 additions & 4 deletions src/unittest_parallel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
# Licensed under the MIT License
# https://github.com/craigahobbs/template-specialize/blob/main/LICENSE

__version__ = '1.4.2'
6 changes: 0 additions & 6 deletions src/unittest_parallel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

import coverage

from . import __version__ as VERSION


def main(argv=None):

Expand All @@ -34,8 +32,6 @@ def main(argv=None):
help='One or more TestCase class has a setUpClass method')
parser.add_argument('--module-fixtures', action='store_true', default=False,
help='One or more test module has a setUpModule method')
parser.add_argument('--version', action='store_true',
help='show version number and quit')
group_unittest = parser.add_argument_group('unittest options')
group_unittest.add_argument('-s', '--start-directory', metavar='START', default='.',
help="Directory to start discovery ('.' default)")
Expand Down Expand Up @@ -63,8 +59,6 @@ def main(argv=None):
group_coverage.add_argument('--coverage-fail-under', metavar='MIN', type=float,
help='Fail if coverage percentage under min')
args = parser.parse_args(args=argv)
if args.version:
parser.exit(message=VERSION + '\n')
if args.coverage_branch:
args.coverage = args.coverage_branch

Expand Down

0 comments on commit d3c59cb

Please sign in to comment.