Skip to content

Commit

Permalink
Updated test command
Browse files Browse the repository at this point in the history
  • Loading branch information
Bernardo-MG committed Jan 7, 2018
1 parent 2f6284e commit 0b16bfa
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 39 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Installation and deployment
setuptools==38.2.5
twine==1.9.1
bernardomg.tox-test-command==1.0.2

# Cookiecutter
cookiecutter==1.6.0
Expand Down
40 changes: 2 additions & 38 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
import sys
import io
from os.path import dirname
from os.path import join

from setuptools import find_packages, setup
from setuptools.command.test import test as test_command
from bernardomg.tox_test_command import ToxTestCommand

"""
PyPI configuration module.
Expand All @@ -27,41 +26,6 @@ def read(*names, **kwargs):
).read()


class _ToxTester(test_command):
"""
Tox test command.
Calls tox for running the tests.
"""
user_options = [
('test-module=', 'm', "Run 'test_suite' in specified module"),
('test-suite=', 's',
"Run single test, case or suite (e.g. 'module.test_suite')"),
('test-runner=', 'r', "Test runner to use"),
('profile=', 'p', 'Test profile to use')
]

def initialize_options(self):
test_command.initialize_options(self)
self.profile = None

def finalize_options(self):
test_command.finalize_options(self)
self.test_args = []

if self.profile is not None:
# Adds the profile argument
# For example: '-e=py36'
self.test_args.append('-e=' + self.profile)

def run_tests(self):
# import here, cause outside the eggs aren't loaded
import tox

errcode = tox.cmdline(self.test_args)
sys.exit(errcode)


setup(
name='cookiecutter-python-library',
packages=find_packages(),
Expand Down Expand Up @@ -95,5 +59,5 @@ def run_tests(self):
],
tests_require=_tests_require,
extras_require={'test': _tests_require},
cmdclass={'test': _ToxTester},
cmdclass={'test': ToxTestCommand},
)
2 changes: 1 addition & 1 deletion {{cookiecutter.package_name}}/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Installation and deployment
setuptools==38.2.5
twine==1.9.1
bernardomg.tox-test-command==1.0.1
bernardomg.tox-test-command==1.0.2

# Testing
tox==2.9.1
Expand Down

0 comments on commit 0b16bfa

Please sign in to comment.