diff --git a/.travis.yml b/.travis.yml index e798535..936f566 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ language: python python: - - 2.7 - - 3.3 - - 3.4 - - 3.5 - - pypy + - 3.6 + - 3.7 + - 3.8 + - 3.9 + - pypy3 install: - pip install tox tox-travis diff --git a/README.rst b/README.rst index e5ae659..110816f 100644 --- a/README.rst +++ b/README.rst @@ -9,37 +9,43 @@ TDDBC for Python with Pytest 動作確認環境 ============ -- Python 2.7.6 -- Python 3.3.1 -- PyPy 1.9.0 -- PyPy 2.2.0 +- Python 3.8.5 +- pytest 6.2.4 + +※Python2は2020年1月にサポート終了(EOL)していますので、Python3をご利用ください。 セットアップ ============ +以下のように実行して、環境を構築してください。 + .. code-block:: sh - $ pip install -r requirements.txt + $ git clone https://github.com/yattom/python_pytest.git + $ cd python_pytest + $ pip3 install -r requirements.txt -**setup.py** を実行し +テストを実行するには **pytest** コマンドを使います。 .. code-block:: sh - $ python setup.py test + $ pytest ... # Output sample - ======================== test session starts ================================= - platform linux2 -- Python 2.7.3[pypy-2.2.0-final] -- pytest-2.4.2 - -- ~/.virtualenvs/tddbc_python_pytest_pypy22/bin/python - plugins: cov, xdist + ============================= test session starts ============================== + platform linux -- Python 3.8.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3 + cachedir: .pytest_cache + rootdir: /root/work/python_pytest, configfile: setup.cfg + plugins: forked-1.3.0, cov-2.11.1, xdist-2.2.1 collected 3 items - tests/acme/test_acme.py:28: TestPython.test_be_out_of_question PASSED - tests/acme/test_acme.py:41: TestMontyPython.test_say_name[Monty Python] PASSED - tests/acme/test_acme.py:41: TestMontyPython.test_say_name[John Smith] PASSED - ======================== 3 passed in 0.10 seconds ============================ + tests/acme/test_snake.py::TestPython::test_be_out_of_question PASSED [ 33%] + tests/acme/test_snake.py::TestMontyPython::test_say_name[Monty Python] PASSED [ 66%] + tests/acme/test_snake.py::TestMontyPython::test_say_name[John Smith] PASSED [100%] + + ============================== 3 passed in 0.04s =============================== のように正常終了すればOKです diff --git a/requirements.txt b/requirements.txt index ab0619b..8f8cbf6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,14 @@ +-e . +appdirs==1.4.4 cov-core==1.15.0 -coverage==4.4.1 -execnet==1.4.1 -py==1.4.34 -pytest==3.1.3 -pytest-cov==2.5.1 -pytest-xdist==1.18.0 -tox==2.7.0 -virtualenv==15.1.0 +coverage==5.5 +distlib==0.3.1 +execnet==1.8.0 +filelock==3.0.12 +iniconfig==1.1.1 +py==1.10.0 +pytest-cov==2.11.1 +pytest-xdist==2.2.1 +pytest==6.2.4 +tox==3.23.1 +virtualenv==20.4.6 diff --git a/setup.py b/setup.py index 4687786..d13886d 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,4 @@ from setuptools import setup, find_packages -from setuptools.command.test import test as TestCommand -import sys - - -class PyTest(TestCommand): - def finalize_options(self): - TestCommand.finalize_options(self) - self.test_args = [] - self.test_suite = True - - def run_tests(self): - #import here, cause outside the eggs aren't loaded - import pytest - errno = pytest.main(self.test_args) - sys.exit(errno) setup( name='skeleton_for_pytest', @@ -25,7 +10,6 @@ def run_tests(self): license='MIT', packages=find_packages(exclude=['tests']), tests_require=['pytest'], - cmdclass={'test': PyTest}, classifiers=[ 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', diff --git a/tox.ini b/tox.ini index 2d3a29c..117cff9 100644 --- a/tox.ini +++ b/tox.ini @@ -1,13 +1,13 @@ [tox] skipsdist = True envlist = - py27, - py33, - py34, - py35 + py36, + py37, + py38, + py39 [testenv] deps= -r{toxinidir}/requirements.txt commands= - python setup.py test + pytest