File tree 1 file changed +9
-14
lines changed 1 file changed +9
-14
lines changed Original file line number Diff line number Diff line change 1
- try :
2
- import unittest2 as unittest
3
- except ImportError :
4
- import unittest
5
-
6
1
from mock import patch
7
2
3
+ import pytest
8
4
9
- class TestUnsupportedFamily (unittest .TestCase ):
10
5
11
- def test_unsupported_system (self ):
6
+ def test_unsupported_system ():
12
7
13
- from fabtools .system import UnsupportedFamily
8
+ from fabtools .system import UnsupportedFamily
14
9
15
- with self . assertRaises (UnsupportedFamily ) as cm :
10
+ with pytest . raises (UnsupportedFamily ) as excinfo :
16
11
17
- with patch ('fabtools.system.distrib_id' ) as mock_distrib_id :
18
- mock_distrib_id .return_value = 'foo'
12
+ with patch ('fabtools.system.distrib_id' ) as mock_distrib_id :
13
+ mock_distrib_id .return_value = 'foo'
19
14
20
- raise UnsupportedFamily (supported = ['debian' , 'redhat' ])
15
+ raise UnsupportedFamily (supported = ['debian' , 'redhat' ])
21
16
22
- exception_msg = str (cm . exception )
23
- self . assertEquals ( exception_msg , "Unsupported system foo (supported families: debian, redhat)" )
17
+ exception_msg = str (excinfo . value )
18
+ assert exception_msg == "Unsupported system foo (supported families: debian, redhat)"
You can’t perform that action at this time.
0 commit comments