Skip to content

Commit 5fc6d42

Browse files
authored
Merge pull request #3 from yattom/no_setup
pytestコマンドだけでテストを実行できるようにする
2 parents 6a36ba1 + f21afd5 commit 5fc6d42

File tree

4 files changed

+10
-20
lines changed

4 files changed

+10
-20
lines changed

README.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,19 @@ TDDBC for Python with Pytest
1717
セットアップ
1818
============
1919

20+
以下のように実行して、環境を構築してください。
21+
2022
.. code-block:: sh
2123
24+
$ git clone https://github.com/yattom/python_pytest.git
25+
$ cd python_pytest
2226
$ pip3 install -r requirements.txt
2327
24-
**setup.py** を実行し
28+
テストを実行するには **pytest** コマンドを使います。
2529

2630
.. code-block:: sh
2731
28-
$ python3 setup.py test
32+
$ pytest
2933
3034
...
3135
@@ -40,7 +44,8 @@ TDDBC for Python with Pytest
4044
tests/acme/test_snake.py::TestPython::test_be_out_of_question PASSED [ 33%]
4145
tests/acme/test_snake.py::TestMontyPython::test_say_name[Monty Python] PASSED [ 66%]
4246
tests/acme/test_snake.py::TestMontyPython::test_say_name[John Smith] PASSED [100%]
43-
============================== 3 passed in 0.05s ===============================
47+
48+
============================== 3 passed in 0.04s ===============================
4449
4550
のように正常終了すればOKです
4651

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
-e .
12
appdirs==1.4.4
23
cov-core==1.15.0
34
coverage==5.5

setup.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
from setuptools import setup, find_packages
2-
from setuptools.command.test import test as TestCommand
3-
import sys
4-
5-
6-
class PyTest(TestCommand):
7-
def finalize_options(self):
8-
TestCommand.finalize_options(self)
9-
self.test_args = []
10-
self.test_suite = True
11-
12-
def run_tests(self):
13-
#import here, cause outside the eggs aren't loaded
14-
import pytest
15-
errno = pytest.main(self.test_args)
16-
sys.exit(errno)
172

183
setup(
194
name='skeleton_for_pytest',
@@ -25,7 +10,6 @@ def run_tests(self):
2510
license='MIT',
2611
packages=find_packages(exclude=['tests']),
2712
tests_require=['pytest'],
28-
cmdclass={'test': PyTest},
2913
classifiers=[
3014
'Intended Audience :: Developers',
3115
'License :: OSI Approved :: MIT License',

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ envlist =
1010
deps=
1111
-r{toxinidir}/requirements.txt
1212
commands=
13-
python setup.py test
13+
pytest

0 commit comments

Comments
 (0)