Ver Fonte

Switching from the no-longer-maintained nose test runner to pytest.

Dan Helfman há 9 anos atrás
pai
commit
df9cc6a7d2

+ 2 - 2
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

+ 6 - 6
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())

+ 0 - 3
setup.cfg

@@ -1,5 +1,2 @@
 [metadata]
 description-file=README.md
-
-[nosetests]
-detailed-errors=1

+ 1 - 1
setup.py

@@ -30,6 +30,6 @@ setup(
     },
     tests_require=(
         'flexmock',
-        'nose',
+        'pytest',
     )
 )

+ 1 - 1
test_requirements.txt

@@ -1,2 +1,2 @@
 flexmock==0.10.2
-nose==1.3.4
+pytest==2.9.1

+ 1 - 1
tox.ini

@@ -5,4 +5,4 @@ skipsdist=True
 [testenv]
 usedevelop=True
 deps=-rtest_requirements.txt
-commands = nosetests []
+commands = py.test []