From df9cc6a7d285b9fa4ca09016a34aa4653199c4b9 Mon Sep 17 00:00:00 2001 From: Dan Helfman Date: Sun, 10 Apr 2016 15:59:36 -0700 Subject: [PATCH] Switching from the no-longer-maintained nose test runner to pytest. --- atticmatic/tests/integration/test_command.py | 4 ++-- atticmatic/tests/unit/test_config.py | 12 ++++++------ setup.cfg | 3 --- setup.py | 2 +- test_requirements.txt | 2 +- tox.ini | 2 +- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/atticmatic/tests/integration/test_command.py b/atticmatic/tests/integration/test_command.py index 346612b..b26d815 100644 --- a/atticmatic/tests/integration/test_command.py +++ b/atticmatic/tests/integration/test_command.py @@ -2,7 +2,7 @@ import os import sys from flexmock import flexmock -from nose.tools import assert_raises +import pytest from atticmatic import command as module @@ -66,7 +66,7 @@ def test_parse_arguments_with_invalid_arguments_exits(): sys.stderr = sys.stdout try: - with assert_raises(SystemExit): + with pytest.raises(SystemExit): module.parse_arguments(COMMAND_NAME, '--posix-me-harder') finally: sys.stderr = original_stderr diff --git a/atticmatic/tests/unit/test_config.py b/atticmatic/tests/unit/test_config.py index 88569e1..6422fa5 100644 --- a/atticmatic/tests/unit/test_config.py +++ b/atticmatic/tests/unit/test_config.py @@ -1,7 +1,7 @@ from collections import OrderedDict from flexmock import flexmock -from nose.tools import assert_raises +import pytest from atticmatic import config as module @@ -61,7 +61,7 @@ def test_validate_configuration_format_with_missing_required_section_should_rais ), ) - with assert_raises(ValueError): + with pytest.raises(ValueError): module.validate_configuration_format(parser, config_format) @@ -96,7 +96,7 @@ def test_validate_configuration_format_with_unknown_section_should_raise(): module.Section_format('section', options=()), ) - with assert_raises(ValueError): + with pytest.raises(ValueError): module.validate_configuration_format(parser, config_format) @@ -114,7 +114,7 @@ def test_validate_configuration_format_with_missing_required_option_should_raise ), ) - with assert_raises(ValueError): + with pytest.raises(ValueError): module.validate_configuration_format(parser, config_format) @@ -146,7 +146,7 @@ def test_validate_configuration_format_with_extra_option_should_raise(): ), ) - with assert_raises(ValueError): + with pytest.raises(ValueError): module.validate_configuration_format(parser, config_format) @@ -228,5 +228,5 @@ def test_parse_configuration_with_file_open_error_should_raise(): parser = insert_mock_parser() parser.should_receive('read').and_return([]) - with assert_raises(ValueError): + with pytest.raises(ValueError): module.parse_configuration('filename', config_format=flexmock()) diff --git a/setup.cfg b/setup.cfg index 222a3da..12871ff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,2 @@ [metadata] description-file=README.md - -[nosetests] -detailed-errors=1 diff --git a/setup.py b/setup.py index ff5a4be..f399973 100644 --- a/setup.py +++ b/setup.py @@ -30,6 +30,6 @@ setup( }, tests_require=( 'flexmock', - 'nose', + 'pytest', ) ) diff --git a/test_requirements.txt b/test_requirements.txt index 8969b43..3c5f9e5 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,2 +1,2 @@ flexmock==0.10.2 -nose==1.3.4 +pytest==2.9.1 diff --git a/tox.ini b/tox.ini index 6ac577b..64d1f6c 100644 --- a/tox.ini +++ b/tox.ini @@ -5,4 +5,4 @@ skipsdist=True [testenv] usedevelop=True deps=-rtest_requirements.txt -commands = nosetests [] +commands = py.test []